jejd14 / ccache
A small class for caching information
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:HTML
Requires
- php: >=5.4
This package is not auto-updated.
Last update: 2025-06-25 12:28:54 UTC
README
CCache
About
A small class for chaching information
##Tech
PHP >= 5.4.0
Tested on Anax MVC >= 2.0.4
Introduction
Instantiate an object of CCache:
$newCCache = new \jejd14\ccache\CCache($dir);
Or instantiate an object of CCache as a shared service within the Anax framework:
$di->setShared('cache', function($dir) {
$cache = new \jejd14\ccache\CCache($dir);
return $cache;
});
Methods
- __construct ( $dir) - Constructor
- get ($key) - Get an item from the cache if its there.
- put ($key, $item) - Put an item to the cache.
- prune($key) - Prune a item from cache.
- pruneAll() - Prune all items from cache.
Calling of Methods
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)
Inside a class that extends/implements/uses \Anax\DI\TInjectionAware:
$this->di->cache->put('file','hello');
In your frontcontroller:
$app->cache->put('file','hello');
To prune all items from cache:
$app->cache->pruneAll();
Composer
You can add ccache to your composer.json file like this.
"require": {
"jejd14/ccache": "dev-master"
}
License
MIT