twodevs / cache-interface
为多个适配器提供缓存接口
v1.0.0
2015-01-22 22:35 UTC
Requires
- php: >=5.3.0
Requires (Dev)
- desarrolla2/cache: ~1.8
- doctrine/cache: ~1.4
- illuminate/cache: ~4.2
- phpunit/phpunit: 4.4.*
- zendframework/zend-cache: ~2.3
Suggests
- doctrine/cache: Allows to cache the response container
- zendframework/zend-cache: Allows to cache the response container
This package is auto-updated.
Last update: 2024-08-29 03:41:55 UTC
README
PHP接口库,为多个适配器提供缓存接口。
使用方法
1) 使用ArrayCache(内存缓存)
// Using the array cache
$ws->setCache(new \TwoDevs\Cache\ArrayCache());
2) 如果已安装doctrine缓存,可以使用doctrine缓存适配器来缓存结果容器。
// Create a new DoctrineCache instance
$doctrineCache = new \Doctrine\Common\Cache\FilesystemCache('var/cache');
// Create a new DoctrineCache adapter
$cacheAdapter = new \TwoDevs\Cache\DoctrineCache($doctrineCache);
3) 如果已安装zend缓存,可以使用zend缓存适配器来缓存结果容器。
// Create a new ZendStorage instance
$zendCache = new \Zend\Cache\Storage\Adapter\Memory();
// Create a new ZendCache adapter
$cacheAdapter = new \TwoDevs\Cache\ZendCache($zendCache);