Migrate memcached config to standalone configuration.
This commit is contained in:
parent
39be9f3ba7
commit
5713a45a10
|
@ -7,6 +7,7 @@ pvl.key.txt
|
|||
app/config/db.conf.php
|
||||
app/config/apis.conf.php
|
||||
app/config/influx.conf.php
|
||||
app/config/memcached.conf.php
|
||||
|
||||
# Junk/cache files.
|
||||
*Thumbs.db
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
/**
|
||||
* Memcached configuration and credentials.
|
||||
*/
|
||||
|
||||
return array(
|
||||
'servers' => array(
|
||||
'main' => array(
|
||||
// Host or IP to connect to (default: localhost).
|
||||
'host' => 'localhost',
|
||||
'port' => 11211,
|
||||
|
||||
// Priority for cache storage.
|
||||
'weight' => 1,
|
||||
),
|
||||
),
|
||||
|
||||
);
|
|
@ -179,14 +179,13 @@ class Cache
|
|||
$cache_prefix = self::getSitePrefix().'_user_';
|
||||
|
||||
if (DF_APPLICATION_ENV == 'production') {
|
||||
$di = \Phalcon\Di::getDefault();
|
||||
$config = $di->get('config');
|
||||
|
||||
$servers = $config->memcached->servers->toArray();
|
||||
|
||||
return new \Phalcon\Cache\Backend\Libmemcached($frontCache, array(
|
||||
'servers' => array(
|
||||
array(
|
||||
'host' => 'localhost',
|
||||
'port' => 11211,
|
||||
'weight' => 1
|
||||
),
|
||||
),
|
||||
'servers' => $servers,
|
||||
'client' => array(
|
||||
\Memcached::OPT_HASH => \Memcached::HASH_MD5,
|
||||
\Memcached::OPT_PREFIX_KEY => $cache_prefix,
|
||||
|
|
Loading…
Reference in New Issue