phpe / ccache

缓存内容的类

安装次数: 12

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

公开问题: 0

语言:HTML

v1.0 2015-02-16 14:56 UTC

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');

Scrutinizer Code Quality Code Coverage Build Status