Migrate memcached config to standalone configuration.

This commit is contained in:
Buster "Silver Eagle" Neece 2015-05-12 13:21:29 -05:00
parent 39be9f3ba7
commit 5713a45a10
3 changed files with 25 additions and 7 deletions

1
.gitignore vendored
View File

@ -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

View File

@ -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,
),
),
);

View File

@ -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,