summaryrefslogtreecommitdiff
path: root/adodb-memcache.lib.inc.php
diff options
context:
space:
mode:
authorMark Newnham <mark@newnhams.com>2022-01-04 18:54:22 -0700
committerMark Newnham <mark@newnhams.com>2022-01-04 18:54:22 -0700
commita9133ea547b4fd2db037832795e3d33afa345873 (patch)
tree186225d638182b1ba0098c1d99fd7c17c2a4aefc /adodb-memcache.lib.inc.php
parent8281f55a941a9265299eeb306fec8622207ef6bd (diff)
downloadadodb-a9133ea547b4fd2db037832795e3d33afa345873.tar.gz
adodb-a9133ea547b4fd2db037832795e3d33afa345873.tar.bz2
adodb-a9133ea547b4fd2db037832795e3d33afa345873.zip
Memcache library does not initialize correctly, see #788
The library does not initialize correctly when the object is created as a class variable. Initializing it to a local variable then assigning to a class variable once connected resolves the issue.
Diffstat (limited to 'adodb-memcache.lib.inc.php')
-rw-r--r--adodb-memcache.lib.inc.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/adodb-memcache.lib.inc.php b/adodb-memcache.lib.inc.php
index 16a0ba57..f0155808 100644
--- a/adodb-memcache.lib.inc.php
+++ b/adodb-memcache.lib.inc.php
@@ -150,8 +150,8 @@ class ADODB_Cache_MemCache
$usedLibrary = $this->libraries[$this->libraryFlag];
- $this->memCacheLibrary = new $usedLibrary;
- if (!$this->memcacheLibrary)
+ $memCache = new $usedLibrary;
+ if (!$memCache)
{
$err = 'Memcache library failed to initialize';
return false;
@@ -172,7 +172,7 @@ class ADODB_Cache_MemCache
*/
if ($this->libraryFlag == self::MCLIBD && count($this->options) > 0)
{
- $optionSuccess = $this->memCacheLibrary->setOptions($this->options);
+ $optionSuccess = $memCache->setOptions($this->options);
if (!$optionSuccess)
{
$err = 'Invalid option parameters passed to Memecached';
@@ -237,7 +237,7 @@ class ADODB_Cache_MemCache
* Use the existing configuration
*/
$this->isConnected = true;
- $this->memcacheLibrary = $memcache;
+ $this->memcacheLibrary = $memCache;
return true;
}
}
@@ -247,11 +247,11 @@ class ADODB_Cache_MemCache
switch($this->libraryFlag)
{
case self::MCLIB:
- if (!@$this->memcacheLibrary->addServer($controller['host'],$controller['port']))
+ if (!@$memCache->addServer($controller['host'],$controller['port']))
$failcnt++;
break;
default:
- if (!@$this->memcacheLibrary->addServer($controller['host'],$controller['port'],$controller['weight']))
+ if (!@$memCache->addServer($controller['host'],$controller['port'],$controller['weight']))
$failcnt++;
}
@@ -263,6 +263,8 @@ class ADODB_Cache_MemCache
}
+ $this->memcacheLibrary = $memCache;
+
/*
* A valid memcache connection is available
*/