Commit 8a6b8517 authored by Taylor Otwell's avatar Taylor Otwell

Continue refactoring the memcache class.

parent cb7a5971
...@@ -16,15 +16,16 @@ class Memcached { ...@@ -16,15 +16,16 @@ class Memcached {
*/ */
public static function instance() public static function instance()
{ {
return ( ! is_null(static::$instance)) ? static::$instance : static::$instance = static::connect(); return ( ! is_null(static::$instance)) ? static::$instance : static::$instance = static::connect(Config::get('cache.servers'));
} }
/** /**
* Connect to the configured Memcached servers. * Connect to the configured Memcached servers.
* *
* @param array $servers
* @return Memcache * @return Memcache
*/ */
private static function connect() private static function connect($servers)
{ {
if ( ! class_exists('Memcache')) if ( ! class_exists('Memcache'))
{ {
...@@ -33,7 +34,7 @@ class Memcached { ...@@ -33,7 +34,7 @@ class Memcached {
$memcache = new \Memcache; $memcache = new \Memcache;
foreach (Config::get('cache.servers') as $server) foreach ($servers as $server)
{ {
$memcache->addServer($server['host'], $server['port'], true, $server['weight']); $memcache->addServer($server['host'], $server['port'], true, $server['weight']);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment