Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
D
Django-Redis-Cache
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shared
Django-Redis-Cache
Commits
454f90b7
Commit
454f90b7
authored
Mar 22, 2021
by
Tomi Suomela
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get_or_set(): use read replica when reading values
parent
2867c78f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
base.py
redis_cache/backends/base.py
+4
-2
No files found.
redis_cache/backends/base.py
View file @
454f90b7
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment