return [
SentinelsConfig::class => [
'sentinels' => [
[$sentinelHost1, 26379],
[$sentinelHost2, 26379],
],
'master_sets' => [
'ems' => $masterSet . '?database=' . ConnectionPool::DATABASE_VALUE_EMS, // it means that from the redis connection pool it is fetchable via $pool->ems() method
'cache' => $masterSet . '?database=' . ConnectionPool::DATABASE_VALUE_CACHE, // it means that from the redis connection pool it is fetchable via $pool->cache() method
'rto' => $masterSet . '?database=' . ConnectionPool::DATABASE_VALUE_RTO, // it means that from the redis connection pool it is fetchable via $pool->rto() method
'session' => $masterSet . '?database=' . ConnectionPool::DATABASE_VALUE_SESSION, // it means that from the redis connection pool it is fetchable via $pool->session() method
'jobpool' => $masterSet . '?database=' . ConnectionPool::DATABASE_VALUE_JOB_POOL, // it means that from the redis connection pool it is fetchable via $pool->jobpool() method
'payment' => $masterSet . '?database=' . ConnectionPool::DATABASE_VALUE_PAYMENT, // it means that from the redis connection pool it is fetchable via $pool->payment() method
'messenger' => $masterSet . '?database=' . ConnectionPool::DATABASE_VALUE_MESSENGER, // it means that from the redis connection pool it is fetchable via $pool->messenger() method
'jobArchive' => $masterSet . '?database=' . ConnectionPool::DATABASE_VALUE_JOB_HISTORY_ARCHIVE, // it means that from the redis connection pool it is fetchable via $pool->jobArchive() method
],
],
];Use laminas-cache instead of direct connection!
public function __invoke(ContainerInterface $container)
{
return new QueryCacheManager(
$container->get(CacheManagerInterface::APPLICATION_CACHE)
);
}This code will produce instance of
Laminas\Cache\Storage\StorageInterface
for you and now you can go!
Storage can be reconized as already configured adapter.
CacheManagerInterface::APPLICATION_CACHE => [
'plugins' => ['serializer'],
'options' => [
'sentinel_masterset' => ConnectionPool::CACHE_MASTERSET,
],
'adapter' => [
'name' => PredisCacheAdapter::class,
'options' => [
'namespace' => 'config_cache_'
],
],
],This config is present in
module/Application/config/cache.config.php
and all declared Storages are available via Laminas service locator
$pool = new CacheItemPoolDecorator($storage);$cache = new SimpleCacheDecorator($storage);class QueryCacheManagerFactory extends ConnectionPoolAwareFactory
{
public function __invoke(ContainerInterface $container, Client $client)
{
return new QueryCacheManager(
$client
);
}
}DO NOT DO THAT!!!