【文件属性】:
文件名称:缓存:缓存库
文件大小:24KB
文件格式:ZIP
更新时间:2021-02-02 21:11:31
redis php memcached symfony mongodb
快取
缓存是一个处理缓存后端的小型库,该库还处理计数器。
使用Composer安装
composer require sonata-project/cache
缓存使用率
<?php
use Sonata \ Cache \ Adapter \ Cache \ PRedisCache ;
$ adapter = new PRedisCache ([
'host' => '127.0.0.1' ,
'port' => 6379 ,
'database' => 42 ,
]);
$ keys = [
'objectId' => 10 ,
];
$ adapter -> set ( $ keys , 'MyValue' , 86400 );
$ cacheElement = $ adapter -> get ( $ keys );
$ cacheElement -> getData (); // MyValue
柜台使用
<?php
use Sonata \ Cache \ Adapter \ Counter \ PRedisCounter
【文件预览】:
cache-master
----src()
--------CacheAdapterInterface.php(1KB)
--------Invalidation()
--------Exception()
--------CacheManagerInterface.php(1KB)
--------CacheElement.php(2KB)
--------CounterAdapterInterface.php(706B)
--------Counter.php(826B)
--------CacheManager.php(2KB)
--------CacheElementInterface.php(918B)
--------Adapter()
----LICENSE(1KB)
----composer.json(2KB)