bru2s / cache-service-provider
修改 dafiti/cache-service-provider。增加了文件系统支持。
0.0.4.1
2015-09-17 07:17 UTC
Requires
- php: >=5.4.0
- doctrine/cache: v1.4.0
- silex/silex: ~1.1
Requires (Dev)
- fabpot/php-cs-fixer: @stable
- phpunit/phpunit: @stable
This package is not auto-updated.
Last update: 2024-10-02 10:47:45 UTC
README
一个为 Silex 提供服务的 Doctrine Cache。
安装
{ "require": { "bru2s/cache-service-provider": "dev-master" } }
可用的适配器
要使用 Memcache
sudo apt-get install php5-memcached
要使用 Memcached
sudo apt-get install php5-memcached
要使用 Redis 适配器,请安装 PHPRedis
git clone git@github.com:phpredis/phpredis.git
cd phpredis
phpize
./configure
make && make install
使用方法
use Silex\Application; use Bru2s\Silex\CacheServiceProvider; $app = new Application(); $app['config'] = [ 'cache' => [ 'adapter' => 'Memcache', 'host' => '127.0.0.1', 'port' => 11211, 'connectable' => true // If not need of one connection put FALSE (in Filesystem must be FALSE) ] ]; $app->register(new CacheServiceProvider()); $app['cache']->save('your-key', 'your-data'); $data = $app['cache']->fetch('your-key'); echo $data; // your-data
许可证
MIT 许可证