hautelook / solarium-cache
此包已被弃用且不再维护。未建议替代包。
dev-master / 0.1.x-dev
2015-02-17 23:57 UTC
Requires
- doctrine/cache: ~1.0
- solarium/solarium: ~3.1
Requires (Dev)
- phpspec/prophecy-phpunit: ~1.0
This package is not auto-updated.
Last update: 2020-01-24 15:11:36 UTC
README
Solarium 插件,用于使用 Doctrine Cache 缓存查询。
安装
{ "require": { "hautelook/solarium-cache": "0.1@dev" } }
使用
$client = ...; $cache = new RedisCache(); // or whichever $plugin = new CachePlugin(); $plugin->setCache($cache); $client->registerPlugin('cache', $plugin); $query = $client->createSelect(array( 'cache_lifetime' => 60, )); $result = $client->execute($query);
与 NelmioSolariumBundle 一起使用
public function registerBundles() { $bundles = array( // ... new Hautelook\Solarium\Cache\Bundle\HautelookSolariumCacheBundle(), ); // ... return $bundles; }
配置 Solarium 客户端应该配置的缓存插件,以及 doctrine 缓存服务 ID。
# app/config/config.yml
liip_doctrine_cache:
namespaces:
search:
namespace: search
type: memcache
host: ...
port: ...
hautelook_solarium_cache:
clients:
default: liip_doctrine_cache.ns.search
在此示例中,我们使用 LiipDoctrineCacheBundle 来创建 doctrine 缓存服务。