thefuriouscoder/doctrine-cache-factory
Composer 安装命令:
composer require thefuriouscoder/doctrine-cache-factory
包简介
A simple static wrapper for Docrine Cache drivers.
README 文档
README
A simple static wrapper for Doctrine Cache drivers.
Requirements
- PHP >= 5.3
- Doctrine Cache >= 1.5.1
Install
Composer
Add a dependency on thefuriouscoder/doctrine-cache-factory to your project's composer.json file.
{ "require": { "thefuriouscoder/doctrine-cache-factory": "dev-master" } }
Configuration
Initialize the Cache Store.
Add the following configuration code to your project bootstraping file depending on the storage you are goinng to use.
Using Memcached (php5-memcached extension needed)
// configure memcached setting. TFC\Cache\DoctrineCacheFactory::setOption( [ 'storage' => 'memcached', 'prefix' => 'rlyeh', 'default_ttl' => 3600, 'servers' => [ ['server1', 11211, 20], ['server2', 11211, 80] ] ] );
Using APC
// configure APC setting. TFC\Cache\DoctrineCacheFactory::setOption( [ 'storage' => 'apc', 'default_ttl' => 3600 ] );
Using Redis
// configure Redis setting. TFC\Cache\DoctrineCacheFactory::setOption( [ 'storage' => 'redis', 'prefix' => 'rlyeh', 'host => '127.0.0.1', 'port' => 6379, 'default_ttl' => 3600 ] );
Basic usage
$cache = \TFC\Cache\DoctrineCacheFactory::factory("redis"); $cache->setNamespace("miskatonic"); $cache->save($key,$data); $cache->contains($key); $data = $cache->fetch($key); $cache->delete($key); $cache->deleteAll();
For more detailed instructions on Doctrine cache usage, please refer to doctrine documentation
License
MIT License
统计信息
- 总下载量: 17.31k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-11-05