php composer.phar require mactronique/phpcache-bundle "~1.0"
Add in your app/AppKernel.php :
new Mactronique\Bundle\PhpCacheBundle\MactroniquePhpCacheBundle(),
Add in you app/config/config.yml
mactronique_php_cache:
drivers:
-
name: xcache
-
name: redisoptions:
host: 127.0.0.1port: 6379password: ''database: 1timeout: 1-name: memcachedoptions:-server: 127.0.0.1port: 11211sharing: 100
-
name: "null"In controller :
// Set value into key for 30 seconds
$this->get('mactronique_cache.phpcache')->set('key', 'value', 30);
// Set value into key
$this->get('mactronique_cache.phpcache')->set('key', 'value');
//get key
$this->get('mactronique_cache.phpcache')->get('key');
//check if key exists
$this->get('mactronique_cache.phpcache')->exists('key');
//remove key
$this->get('mactronique_cache.phpcache')->remove('key');
Please fork main repo and send a pull request with your change.
Thanks your in advance !