Fix config value type in MemcachedCacheDriver
- Remove default config values set in CacheDriverFactory
This commit is contained in:
parent
dfa461b3bc
commit
7b8efcc23d
2 changed files with 8 additions and 6 deletions
|
@ -24,20 +24,20 @@ class CacheDriverFactory
|
|||
|
||||
switch ($driver) {
|
||||
case 'memcache':
|
||||
$memcache_host = Config::get('system', 'memcache_host', '127.0.0.1');
|
||||
$memcache_port = Config::get('system', 'memcache_port', 11211);
|
||||
$memcache_host = Config::get('system', 'memcache_host');
|
||||
$memcache_port = Config::get('system', 'memcache_port');
|
||||
|
||||
return new MemcacheCacheDriver($memcache_host, $memcache_port);
|
||||
break;
|
||||
|
||||
case 'memcached':
|
||||
$memcached_hosts = Config::get('system', 'memcached_hosts', [['127.0.0.1', 11211]]);
|
||||
$memcached_hosts = Config::get('system', 'memcached_hosts');
|
||||
|
||||
return new MemcachedCacheDriver($memcached_hosts);
|
||||
break;
|
||||
case 'redis':
|
||||
$redis_host = Config::get('system', 'redis_host', '127.0.0.1');
|
||||
$redis_port = Config::get('system', 'redis_port', 6379);
|
||||
$redis_host = Config::get('system', 'redis_host');
|
||||
$redis_port = Config::get('system', 'redis_port');
|
||||
|
||||
return new RedisCacheDriver($redis_host, $redis_port);
|
||||
break;
|
||||
|
|
|
@ -41,7 +41,9 @@ class MemcachedCacheDriver extends AbstractCacheDriver implements IMemoryCacheDr
|
|||
$this->memcached = new Memcached();
|
||||
|
||||
array_walk($memcached_hosts, function (&$value) {
|
||||
if (is_string($value)) {
|
||||
$value = array_map('trim', explode(',', $value));
|
||||
}
|
||||
});
|
||||
|
||||
$this->memcached->addServers($memcached_hosts);
|
||||
|
|
Loading…
Reference in a new issue