PHP高级缓存系统:Cachearium
Cachearium 是一个用于 PHP 应用的高级缓存框架,具有简单和快速的特点。
- recursive cache system, all the nested russian dolls you ever wanted
- easy to integrate with your existing classes
- key based cache expiration, no more headaches to invalidate stuff
- multiple dependencies
- lifetime expiration, because stuff rots
- low level cache storage access, when you want to go raw
- lots of examples and tests ready to copy/paste
- variable fragments for things that are almost the same but not quite
- pluggable backend modules: RAM, Memcached, Filesystem and you can add your own
- detailed logs for profiling and debugging, and also see what is cached live in your webpage
示例代码:
$data = 'xxxx'; // store $cache = CacheAbstract::factory('your backend'); $cache->store($data, new CacheKey('Namespace', 'Subname')); // get it later try { $data2 = $cache->get(new CacheKey('Namespace', 'Subname')); // $data2 == 'xxxx'; } catch (NotCachedException($e)) { // handle not cached } // store new value with automatic invalidation $data = 'yyy'; $cache->store($data, new CacheKey('Namespace', 'Subname'));
本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!