dafiti/cache-service-provider

A Silex Service Provider for Doctrine Cache

0.0.3 2015-05-14 19:04 UTC

This package is not auto-updated.

Last update: 2021-06-11 23:29:49 UTC


README

Build Status Scrutinizer Code Quality Code Coverage HHVM Latest Stable Version Total Downloads License

A Silex Service Provider for Doctrine Cache.

Instalation

{
    "require": {
        "dafiti/cache-service-provider": "dev-master"
    }
}

Adapters Availables

To use Memcache

sudo apt-get install php5-memcached

To use Memcached

sudo apt-get install php5-memcached

To use Redis Adapter install PHPRedis

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

Usage

use Silex\Application;
use Dafiti\Silex\CacheServiceProvider;

$app = new Application();
$app['config'] = [
    'cache' => [
        'adapter'       => 'Memcache',
        'host'          => '127.0.0.1',
        'port'          => 11211,
        'connectable'   => true // If not need of one connection put FALSE
    ]
];

$app->register(new CacheServiceProvider());

$app['cache']->save('your-key', 'your-data');
$data = $app['cache']->fetch('your-key');

echo $data; // your-data

License

MIT License