korim/fusion-cache

内存+文件混合缓存

0.1.0 2014-01-26 02:46 UTC

This package is auto-updated.

Last update: 2024-09-07 06:56:57 UTC


README

内存+文件混合缓存系统

这是一个混合使用的缓存系统,它结合了挥发性内存缓存(如Web服务器重启时会清除的缓存)和持久性文件缓存(如不同类型的缓存)等功能。在构造函数中,您需要指定主缓存和辅助缓存的获取闭包。

<?php

use Koriym\FusionCache\DoctrineCache as FusionCache;
use Doctrine\Common\Cache\ApcCache;
use Doctrine\Common\Cache\FilesystemCache;

$cache = new FusionCache(new ApcCache, function () {return new FilesystemCache(sys_get_temp_dir());});
$data = $cache->fetch('cache_key')

要求