From ded095a7282658bfe3f98f7489c9b1ad52e75e8d Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Fri, 27 Mar 2009 08:03:53 +0000 Subject: [PATCH] authmemcookie: Support multiple servers. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds support for listing multiple servers in the 'memcache.host' option. Patch contributed by Pavel ΔΉ ejnoha. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1444 44740490-163a-0410-bde0-09ae8108e29a --- config-templates/authmemcookie.php | 5 +++-- lib/SimpleSAML/AuthMemCookie.php | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/config-templates/authmemcookie.php b/config-templates/authmemcookie.php index b9f585d29..967151248 100644 --- a/config-templates/authmemcookie.php +++ b/config-templates/authmemcookie.php @@ -47,13 +47,14 @@ $config = array( 'groups' => NULL, /* - * This option contains the hostname of IP address of the memcache server where we should store the - * authentication information. Thos option should match the address part of the + * This option contains the hostnames or IP addresses of the memcache servers where we should store the + * authentication information. Separator is a comma. This option should match the address part of the * Auth_memCookie_Memcached_AddrPort option in the Auth MemCookie configuration. * * Examples: * 'memcache.host' => '192.168.93.52', * 'memcache.host' => 'memcache.example.org', + * 'memcache.host' => 'memcache1.example.org,memcache2.example.org' * * Default: * 'memcache.host' => '127.0.0.1', diff --git a/lib/SimpleSAML/AuthMemCookie.php b/lib/SimpleSAML/AuthMemCookie.php index 771b73740..4a49edf5d 100644 --- a/lib/SimpleSAML/AuthMemCookie.php +++ b/lib/SimpleSAML/AuthMemCookie.php @@ -125,7 +125,10 @@ class SimpleSAML_AuthMemCookie { } $memcache = new Memcache; - $memcache->connect($memcacheHost, $memcachePort); + + foreach (split(",",$memcacheHost) as $memcacheHost) { + $memcache->addServer($memcacheHost, $memcachePort); + } return $memcache; } -- GitLab