phpe / ccache
缓存内容的类
v1.0
2015-02-16 14:56 UTC
Requires
- php: >=5.3
This package is not auto-updated.
Last update: 2024-10-02 07:50:40 UTC
README
关于
一个非常轻量且简单的缓存内容类。
PHP 5 >= 5.3.0
简介
创建一个 CCache 对象,例如 $cache = new \phpe\cache\CCache($aPath);
然后你可以使用 $cache->Put('nameOfFile', 'contentInFile'); 创建一个缓存文件
当你想获取缓存文件的内容时,调用 $cache->Get('nameOfFile');
你可以使用 $cache->Prune('nameOfFile'); 来移除某个项目,或者使用 $cache->PruneAll('nameOfFile'); 来移除所有项目
使用 anax-mvc
将其设置为 $Di 的一部分,例如:
$di->setShared('cache', function() { $cache = new \phpe\cache\CCache('目录路径'); return $cache; });
然后,你可以根据需要,在代码的任何位置通过 $app 或 $di 来访问 CLog 类;$app->cache->Put('file', 'hello'); 或 $this->di->cache->Put('file', 'hello');