2017 © Pedro Peláez
 

library doctrine-cache-factory

A Doctrine Cache Factory

image

pcelta/doctrine-cache-factory

A Doctrine Cache Factory

  • Friday, August 4, 2017
  • by pcelta
  • Repository
  • 0 Watchers
  • 7 Stars
  • 7,170 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 6 Versions
  • 5 % Grown

The README.md

Cache Service Provider

Build Status Scrutinizer Code Quality Code Coverage Latest Stable Version Total Downloads License, (*1)

doctrine-cache-factory

Doctrine Cache Factory it's better way to uncouple your application of the cache adapters. Changing just the configuration the factory will load a different client., (*2)

Instalation

{
    "require": {
        "pcelta/doctrine-cache-factory": "dev-master"
    }
}

Adapters Availables

  • Custom
  • Array
  • Memcache
  • Memcached
  • Redis

Write your own adapter

Use the adapter namespace to specify the location of your adapter., (*3)


use Pcelta\Doctrine\Cache\Factory; $factory = new Factory(); $cacheSettings [ 'adapter' => 'Memcache', 'adapter_namespace' => '\Doctrine\Common\Cache\%sCache', 'host' => '127.0.0.1', 'port' => 11211, ]; $cacheProvider = $factory->create($cacheSettings);

How to use Array


use Pcelta\Doctrine\Cache\Factory; $factory = new Factory(); $cacheSettings [ 'adapter' => 'Array', ]; $cacheProvider = $factory->create($cacheSettings);

How to use Memcache

Install php5-memcache, (*4)

sudo apt-get install php5-memcache


use Pcelta\Doctrine\Cache\Factory; $factory = new Factory(); $cacheSettings [ 'adapter_name' => 'Memcache', 'host' => '127.0.0.1', 'port' => 11211, ]; $cacheProvider = $factory->create($cacheSettings);

How to use Memcached

Install php5-memcached, (*5)

sudo apt-get install php5-memcached


use Pcelta\Doctrine\Cache\Factory; $factory = new Factory(); $cacheSettings [ 'adapter_name' => 'Memcached', 'host' => '127.0.0.1', 'port' => 11211, ]; $cacheProvider = $factory->create($cacheSettings);

How to use Redis

install PHPRedis, (*6)

git clone git@github.com:phpredis/phpredis.git
cd phpredis
phpize
./configure
make && make install

use Pcelta\Doctrine\Cache\Factory; $factory = new Factory(); $cacheSettings [ 'adapter_name' => 'Redis', 'host' => '127.0.0.1', 'port' => 11211, ]; $cacheProvider = $factory->create($cacheSettings);

General Usage


use Pcelta\Doctrine\Cache\Factory; $factory = new Factory(); $cacheSettings [ 'adapter_name' => 'Memcache', 'host' => '127.0.0.1', 'port' => 11211, ]; $cacheProvider = $factory->create($cacheSettings); $cacheProvider->save('your-key', 'your-data'); $data = $cacheProvider->fetch('your-key'); echo $data; // your-data

Comparing Doctrine Cache Factory with Doctrine Cache Pure

Doctrine Cache


$memcache = new Memcache(); // it's bad to uncouple $memcache->connect('memcache_host', 11211); $cacheDriver = new \Doctrine\Common\Cache\MemcacheCache(); $cacheDriver->setMemcache($memcache); $cacheDriver->save('cache_id', 'my_data');

Doctrine Cache Factory


$factory = new \Pcelta\Doctrine\Cache\Factory(); $cacheSettings [ 'adapter_name' => 'Memcache', // it's much better 'host' => '127.0.0.1', 'port' => 11211, ]; $cacheProvider = $factory->create($cacheSettings); $cacheProvider->save('cache_id', 'your-data');

Road Map

  • Couchbase

License

MIT License, (*7)

The Versions

04/08 2017

dev-master

9999999-dev

A Doctrine Cache Factory

  Sources   Download

MIT

The Requires

 

The Development Requires

by Pedro Ribeiro da Silva Neto

cache doctrine pcelta

28/06 2016

0.1.0

0.1.0.0

A Doctrine Cache Factory

  Sources   Download

MIT

The Requires

 

The Development Requires

by Pedro Ribeiro da Silva Neto

cache doctrine pcelta

28/06 2016

dev-upgrade-doctrine-cache-version

dev-upgrade-doctrine-cache-version

A Doctrine Cache Factory

  Sources   Download

MIT

The Requires

 

The Development Requires

by Pedro Ribeiro da Silva Neto

cache doctrine pcelta

25/06 2016

0.0.2

0.0.2.0

A Doctrine Cache Factory

  Sources   Download

MIT

The Requires

 

The Development Requires

by Pedro Ribeiro da Silva Neto

cache doctrine pcelta

24/06 2016

dev-refactoring

dev-refactoring

A Doctrine Cache Factory

  Sources   Download

MIT

The Requires

 

The Development Requires

by Pedro Ribeiro da Silva Neto

cache doctrine pcelta

26/05 2015

0.0.1

0.0.1.0

A Doctrine Cache Factory

  Sources   Download

MIT

The Requires

 

The Development Requires

by Pedro Ribeiro da Silva Neto

cache doctrine pcelta