orbisnull/localcache

此包已被废弃,不再维护。未建议替代包。

php缓存在apc,xcache文件等

dev-master 2023-01-07 16:18 UTC

This package is not auto-updated.

Last update: 2023-01-16 03:53:12 UTC


README

警告 存储库过时且已废弃!🚫 无活跃开发或任何支持!☠️

LocalCache

此代码的部分基于或改编自 [Adam King] (https://github.com/agking/php-cache-class) 的原始作品

一个简单的PHP composer模块,使用单例设计模式处理缓存数据。

目前支持APC,但可能适应'eaccelerator'、'xcache'、'file'等。

$cache = LocalCache::getInstance();
if (false !== ($data = $cache->get($id))) {
    $data = get_data_from_db($id);
    $cache->set($id, $data);
}
return $data;

LocalCache中的数据会自动进行序列化/反序列化。