Wallogit.com
2017 © Pedro Peláez
Class for caching content
A very light and simple class that caches content., (*1)
PHP 5 >= 5.3.0
Create an object of CCache like $cache = new \phpe\cache\CCache($aPath);, (*2)
Then you can create a cache file with $cache->Put('nameOfFile', 'contentInFile');, (*3)
When you want to get the content of a cache file, call $cache->Get('nameOfFile');, (*4)
You can also prune an item with $cache->Prune('nameOfFile'); or prune all items with $cache->PruneAll('nameOfFile');, (*5)
Make it apart of $Di like:, (*6)
$di->setShared('cache', function() { $cache = new \phpe\cache\CCache('path to dir'); return $cache; });, (*7)
Then can you, depenending where in the code you want to reach CLog, reach the class whit either $app or $di; $app->cache->Put('file', 'hello'); or $this->di->cache->Put('file', 'hello');, (*8)