Commit 454f90b7 authored by Tomi Suomela's avatar Tomi Suomela

get_or_set(): use read replica when reading values

parent 2867c78f
......@@ -455,8 +455,10 @@ class BaseRedisCache(BaseCache):
lock_key = "__lock__" + key
fresh_key = "__fresh__" + key
is_fresh = self._get(client, fresh_key)
value = self._get(client, key)
read_client = self.get_client(fresh_key, write=False)
is_fresh = self._get(read_client, fresh_key) # use read client
read_client = self.get_client(key, write=False)
value = self._get(read_client, key) # use read client
if is_fresh:
return value
......
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