From ae89f290577d5d71238637b2f210306e28043d95 Mon Sep 17 00:00:00 2001 From: Chris Boulton Date: Sun, 1 Aug 2010 15:03:28 +1000 Subject: [PATCH] Update changelog. Formatting fixes --- CHANGELOG.markdown | 2 ++ lib/Resque.php | 23 +++++++++++------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown index 8c77002..a773751 100644 --- a/CHANGELOG.markdown +++ b/CHANGELOG.markdown @@ -3,6 +3,8 @@ PHP. * Implement ability to have setUp and tearDown methods for jobs, called before and after every single run. +* Ability to specify a cluster/multiple redis servers and consistent hash +between them (Thanks dceballos) ## 1.0 (2010-04-18) ## diff --git a/lib/Resque.php b/lib/Resque.php index df91fc3..aa48f8d 100644 --- a/lib/Resque.php +++ b/lib/Resque.php @@ -22,21 +22,20 @@ class Resque * Given a host/port combination separated by a colon, set it as * the redis server that Resque will talk to. * - * @param string $server Host/port combination separated by a colon. + * @param mixed $server Host/port combination separated by a colon, or + * a nested array of servers with host/port pairs. */ public static function setBackend($server) { - if(is_array($server)) { - - require_once dirname(__FILE__) . '/Resque/RedisCluster.php'; - self::$redis = new Resque_RedisCluster($server); - - }else{ - list($host, $port) = explode(':', $server); - - require_once dirname(__FILE__) . '/Resque/Redis.php'; - self::$redis = new Resque_Redis($host, $port); - } + if(is_array($server)) { + require_once dirname(__FILE__) . '/Resque/RedisCluster.php'; + self::$redis = new Resque_RedisCluster($server); + } + else { + list($host, $port) = explode(':', $server); + require_once dirname(__FILE__) . '/Resque/Redis.php'; + self::$redis = new Resque_Redis($host, $port); + } } /**