From ea2cd45dc8a11360e97eba02e34779744d54719a Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 27 Jan 2013 15:56:35 +0100 Subject: [PATCH] Fixed Memcached implementation Thanks to @TimWolla --- .../lib/system/cache/source/MemcachedAdapter.class.php | 2 +- .../system/cache/source/MemcachedCacheSource.class.php | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/lib/system/cache/source/MemcachedAdapter.class.php b/wcfsetup/install/files/lib/system/cache/source/MemcachedAdapter.class.php index 36e235bd31..357b395d46 100644 --- a/wcfsetup/install/files/lib/system/cache/source/MemcachedAdapter.class.php +++ b/wcfsetup/install/files/lib/system/cache/source/MemcachedAdapter.class.php @@ -31,7 +31,7 @@ class MemcachedAdapter extends SingletonFactory { // init memcached if (CACHE_SOURCE_MEMCACHED_USE_PCONNECT) { - $this->memcached = new \Memcached('wcf_memcached'); + $this->memcached = new \Memcached('wcf'.WCF_N.'_memcached'); } else { $this->memcached = new \Memcached(); diff --git a/wcfsetup/install/files/lib/system/cache/source/MemcachedCacheSource.class.php b/wcfsetup/install/files/lib/system/cache/source/MemcachedCacheSource.class.php index 16d7fe19fc..c7d9d07fd2 100644 --- a/wcfsetup/install/files/lib/system/cache/source/MemcachedCacheSource.class.php +++ b/wcfsetup/install/files/lib/system/cache/source/MemcachedCacheSource.class.php @@ -48,7 +48,7 @@ class MemcachedCacheSource implements ICacheSource { /** * Returns the memcached adapter. * - * @return \MemcachedAdapter + * @return wcf\system\cache\source\MemcachedAdapter */ public function getAdapter() { return $this->adapter; @@ -127,7 +127,13 @@ class MemcachedCacheSource implements ICacheSource { */ public function get(array $cacheResource) { $value = $this->getAdapter()->getMemcached()->get($cacheResource['file']); - if ($value === false) return null; + if ($value === false) { + // check if result code if return values is a boolean value instead of no result + if ($this->getAdapter()->getMemcached()->getResultCode() == \Memcached::RES_NOTFOUND) { + return null; + } + } + return $value; } -- 2.20.1