vpg / titon.cache
Titon 缓存包提供支持多种存储引擎的数据缓存层。
v1.3.2
2018-03-01 11:19 UTC
Requires
- php: >=5.4.0
- vpg/titon.common: ^1.4
Replaces
- titon/cache: *
This package is not auto-updated.
Last update: 2024-09-28 15:59:58 UTC
README
提供支持流行存储引擎(如Memcache、APC、Redis、Wincache、Xcache和本地文件系统)的数据缓存层。可以使用Cache
实例来管理和与Storage
引擎交互。
$cache = new Titon\Cache\Cache(); $cache->addStorage('memcache', new Titon\Cache\Storage\MemcacheStorage()); $cache->addStorage('fs', new Titon\Cache\Storage\FileSystemStorage()); $cache->set('foo', $data, '+1 hour', 'memcache'); $data = $cache->get('bar', 'fs');
Storage
引擎也可以外部使用,主要用于将缓存注入到其他服务中。
$apc = new Titon\Cache\Storage\ApcStorage(); $apc->remove('foo');
特性
Cache
- 存储管理层Storage
- 厂商特定的缓存机制
依赖
常用
Io
(可选,用于FileSystemStorage)Db
(可选,用于DatabaseStorage)
要求
- PHP 5.4.0
- Igbinary(可选)
- Apc(用于ApcStorage)
- Memcached(用于MemcacheStorage)
- Redis(用于RedisStorage)
- Wincache(用于WincacheStorage)
- Xcache(用于XcacheStorage)