Wallogit.com
2017 © Pedro Peláez
A small class for caching information
A small class for chaching information, (*2)
PHP >= 5.4.0
Tested on Anax MVC >= 2.0.4
Instantiate an object of CCache:, (*3)
$newCCache = new \jejd14\ccache\CCache($dir);
Or instantiate an object of CCache as a shared service within the Anax framework:, (*4)
$di->setShared('cache', function($dir) {
$cache = new \jejd14\ccache\CCache($dir);
return $cache;
});
To properly use the methods listed above you can call it as follows (Assuming you've set the service as a shared service in your frontcontroller), (*5)
Inside a class that extends/implements/uses \Anax\DI\TInjectionAware:, (*6)
$this->di->cache->put('file','hello');
In your frontcontroller:, (*7)
$app->cache->put('file','hello');
To prune all items from cache:, (*8)
$app->cache->pruneAll();
You can add ccache to your composer.json file like this., (*9)
"require": {
"jejd14/ccache": "dev-master"
}
MIT, (*10)