perf/caching
最新稳定版本:3.1.1
Composer 安装命令:
composer require perf/caching
包简介
Allows to store data with caching engines (Memcache, file system, etc).
README 文档
README
Allows caching of data (with Memcached, file-system, etc).
Usage
Initialization
<?php use perf\Caching\CacheClient; use perf\Caching\Storage\FileSystemCachingStorage; use perf\Caching\Storage\MemcachedCachingStorage; use perf\Caching\Storage\NullCachingStorage; use perf\Caching\Storage\VolatileCachingStorage; // Memcached $storage = MemcachedCachingStorage::createFromCredentials('1.2.3.4', 123); $cache = CacheClient::createWithStorage($storage); // Volatile storage $storage = new VolatileCachingStorage(); $cache = CacheClient::createWithStorage($storage); // File-system storage $storage = new FileSystemCachingStorage('/tmp/cache'); $cache = CacheClient::createWithStorage($storage); // Null storage (caches nothing) $storage = new NullCachingStorage(); $cache = CacheClient::createWithStorage($storage);
Storing and retrieving data
<?php $objectToStore = new \stdClass(); $objectToStore->bar = 'baz'; $cache->store('foo', $objectToStore); // ... $object = $cache->tryFetch('foo');
统计信息
- 总下载量: 475
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 2
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-03-23