From 8a6b85175e9215bfd614610f6961c7c909710108 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 8 Aug 2011 09:18:08 -0500 Subject: [PATCH] Continue refactoring the memcache class. --- system/memcached.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/system/memcached.php b/system/memcached.php index e42eaedb..95350311 100644 --- a/system/memcached.php +++ b/system/memcached.php @@ -16,15 +16,16 @@ class Memcached { */ 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. * + * @param array $servers * @return Memcache */ - private static function connect() + private static function connect($servers) { if ( ! class_exists('Memcache')) { @@ -33,7 +34,7 @@ private static function connect() $memcache = new \Memcache; - foreach (Config::get('cache.servers') as $server) + foreach ($servers as $server) { $memcache->addServer($server['host'], $server['port'], true, $server['weight']); }