hautelook / solarium-cache
Installs: 63 952
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 15
Forks: 1
Open Issues: 1
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 Plugin to cache queries using Doctrine Cache.
Installation
{ "require": { "hautelook/solarium-cache": "0.1@dev" } }
Usage
$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);
Usage with the NelmioSolariumBundle
public function registerBundles() { $bundles = array( // ... new Hautelook\Solarium\Cache\Bundle\HautelookSolariumCacheBundle(), ); // ... return $bundles; }
Configure the bundle which solarium client should have the cache plugin configured, along with the doctrine cache service 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
In this example we use the LiipDoctrineCacheBundle to create a doctrine cache service.