Commit bf62839f authored by Tomi Suomela's avatar Tomi Suomela

__fresh__ key deletion added

parent 3ed64189
Pipeline #9716 failed with stages
in 2 minutes and 33 seconds
......@@ -284,10 +284,14 @@ class BaseRedisCache(BaseCache):
@get_client(write=True)
def delete(self, client, key):
"""Remove a key from the cache."""
client.delete("__fresh__" + key)
return client.delete(key)
def _delete_many(self, client, keys):
return client.delete(*keys)
all_keys = keys.copy()
for key in keys:
all_keys.append("__fresh__" + key)
return client.delete(*all_keys)
def delete_many(self, keys, version=None):
"""
......@@ -360,8 +364,12 @@ class BaseRedisCache(BaseCache):
"""
@get_client(write=True)
def touch(self, client, key, timeout=DEFAULT_TIMEOUT):
def touch(self, client, key, timeout=DEFAULT_TIMEOUT, stale_cache_timeout=None):
"""Reset the timeout of a key to `timeout` seconds."""
key_timeout = (
None if stale_cache_timeout is None else timeout + stale_cache_timeout
)
client.expire("__fresh__" + key, key_timeout)
return client.expire(key, timeout)
#####################
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment