summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-01-08 13:21:29 -0800
committerEvan Prodromou <evan@status.net>2010-01-08 13:21:29 -0800
commite22af049a8df3e120ea88387d013dedec8554c43 (patch)
treebb8b51252557f63f876f8429614954b6784d89c6
parent8901e01692e6010a371a4aa2e5a9b3649e0bcc2f (diff)
persistent connection flag, default false on cli
-rw-r--r--plugins/MemcachePlugin.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/plugins/MemcachePlugin.php b/plugins/MemcachePlugin.php
index b714fb25f..5f93e9a83 100644
--- a/plugins/MemcachePlugin.php
+++ b/plugins/MemcachePlugin.php
@@ -57,6 +57,8 @@ class MemcachePlugin extends Plugin
public $compressThreshold = 20480;
public $compressMinSaving = 0.2;
+ public $persistent = null;
+
/**
* Initialize the plugin
*
@@ -67,6 +69,9 @@ class MemcachePlugin extends Plugin
function onInitializePlugin()
{
+ if (is_null($this->persistent)) {
+ $this->persistent = (php_sapi_name() == 'cli') ? false : true;
+ }
$this->_ensureConn();
return true;
}
@@ -149,15 +154,15 @@ class MemcachePlugin extends Plugin
$port = 11211;
}
- $this->_conn->addServer($host, $port);
+ $this->_conn->addServer($host, $port, $this->persistent);
}
} else {
- $this->_conn->addServer($this->servers);
+ $this->_conn->addServer($this->servers, $this->persistent);
list($host, $port) = explode(';', $this->servers);
if (empty($port)) {
$port = 11211;
}
- $this->_conn->addServer($host, $port);
+ $this->_conn->addServer($host, $port, $this->persistent);
}
// Compress items stored in the cache if they're over threshold in size