diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-06-02 09:11:33 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-06-02 09:11:33 +0200 |
commit | cf2c599218f01c1351cee2e4e48ee4b430f55287 (patch) | |
tree | 67daea46a2252a53c0da05d9de59c75c8e90996e /apps/user_ldap/lib | |
parent | baca5c60c010cb26d3845ad3863fe59e16a0a042 (diff) | |
parent | e5a91fc185c4c992469e19d37c4ad3691ed1d3ae (diff) | |
download | nextcloud-server-cf2c599218f01c1351cee2e4e48ee4b430f55287.tar.gz nextcloud-server-cf2c599218f01c1351cee2e4e48ee4b430f55287.zip |
Merge pull request #16200 from owncloud/kill-globalfilecache
Drop file caching
Diffstat (limited to 'apps/user_ldap/lib')
-rw-r--r-- | apps/user_ldap/lib/proxy.php | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/apps/user_ldap/lib/proxy.php b/apps/user_ldap/lib/proxy.php index 1cc81b8d1d5..347ea9ce6a9 100644 --- a/apps/user_ldap/lib/proxy.php +++ b/apps/user_ldap/lib/proxy.php @@ -37,12 +37,18 @@ abstract class Proxy { static private $accesses = array(); private $ldap = null; + /** @var \OCP\ICache|null */ + private $cache; + /** * @param ILDAPWrapper $ldap */ public function __construct(ILDAPWrapper $ldap) { $this->ldap = $ldap; - $this->cache = \OC\Cache::getGlobalCache(); + $memcache = \OC::$server->getMemCacheFactory(); + if($memcache->isAvailable()) { + $this->cache = $memcache->create(); + } } /** @@ -151,7 +157,7 @@ abstract class Proxy { * @return mixed|null */ public function getFromCache($key) { - if(!$this->isCached($key)) { + if(is_null($this->cache) || !$this->isCached($key)) { return null; } $key = $this->getCacheKey($key); @@ -164,6 +170,9 @@ abstract class Proxy { * @return bool */ public function isCached($key) { + if(is_null($this->cache)) { + return false; + } $key = $this->getCacheKey($key); return $this->cache->hasKey($key); } @@ -173,12 +182,18 @@ abstract class Proxy { * @param mixed $value */ public function writeToCache($key, $value) { + if(is_null($this->cache)) { + return; + } $key = $this->getCacheKey($key); $value = base64_encode(serialize($value)); $this->cache->set($key, $value, '2592000'); } public function clearCache() { + if(is_null($this->cache)) { + return; + } $this->cache->clear($this->getCacheKey(null)); } } |