Refs #29887, #27480 -- Moved touch() to BaseMemcachedCache.

This commit is contained in:
Nick Pope 2020-08-17 00:18:51 +01:00 committed by Mariusz Felisiak
parent 0cb0d59b23
commit e2013b260a
1 changed files with 4 additions and 4 deletions

View File

@ -79,6 +79,10 @@ class BaseMemcachedCache(BaseCache):
# make sure the key doesn't keep its old value in case of failure to set (memcached's 1MB limit)
self._cache.delete(key)
def touch(self, key, timeout=DEFAULT_TIMEOUT, version=None):
key = self.make_key(key, version=version)
return bool(self._cache.touch(key, self.get_backend_timeout(timeout)))
def delete(self, key, version=None):
key = self.make_key(key, version=version)
self.validate_key(key)
@ -167,10 +171,6 @@ class MemcachedCache(BaseMemcachedCache):
self._client = self._lib.Client(self._servers, **client_kwargs)
return self._client
def touch(self, key, timeout=DEFAULT_TIMEOUT, version=None):
key = self.make_key(key, version=version)
return self._cache.touch(key, self.get_backend_timeout(timeout)) != 0
def get(self, key, default=None, version=None):
key = self.make_key(key, version=version)
val = self._cache.get(key)