summaryrefslogtreecommitdiffstats
path: root/memcache.install
diff options
context:
space:
mode:
Diffstat (limited to 'memcache.install')
-rw-r--r--memcache.install32
1 files changed, 18 insertions, 14 deletions
diff --git a/memcache.install b/memcache.install
index 91b7a68..aee97dc 100644
--- a/memcache.install
+++ b/memcache.install
@@ -31,13 +31,15 @@ function memcache_enable() {
// Make a test connection to all configured memcache servers.
$memcache_servers = variable_get('memcache_servers', array('127.0.0.1:11211' => 'default'));
foreach ($memcache_servers as $server => $bin) {
- $memcache = dmemcache_instance($bin);
- if (dmemcache_connect($memcache, $server, FALSE) === FALSE) {
- $error = TRUE;
- }
- else {
- if (!variable_get('memcache_persistent', TRUE)) {
- dmemcache_close($memcache);
+ if ($cluster = dmemcache_object_cluster($bin)) {
+ $memcache = dmemcache_instance($cluster['cluster']);
+ if (dmemcache_connect($memcache, $server, $cluster['weight']) === FALSE) {
+ $error = TRUE;
+ }
+ else {
+ if (!variable_get('memcache_persistent', TRUE)) {
+ dmemcache_close($memcache);
+ }
}
}
}
@@ -114,13 +116,15 @@ function memcache_requirements($phase) {
// Make a test connection to all configured memcache servers.
$memcache_servers = variable_get('memcache_servers', array('127.0.0.1:11211' => 'default'));
foreach ($memcache_servers as $server => $bin) {
- $memcache = dmemcache_instance($bin);
- if (dmemcache_connect($memcache, $server, FALSE) === FALSE) {
- $errors[] = $t('Failed to connect to memcached server instance at %server.', array('%server' => $server));
- }
- else {
- if (!variable_get('memcache_persistent', TRUE)) {
- dmemcache_close($memcache);
+ if ($cluster = dmemcache_object_cluster($bin)) {
+ $memcache = dmemcache_instance($cluster['cluster']);
+ if (dmemcache_connect($memcache, $server, $cluster['weight']) === FALSE) {
+ $errors[] = $t('Failed to connect to memcached server instance at %server.', array('%server' => $server));
+ }
+ else {
+ if (!variable_get('memcache_persistent', TRUE)) {
+ dmemcache_close($memcache);
+ }
}
}
}