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
bf62839f
Commit
bf62839f
authored
Oct 11, 2020
by
Tomi Suomela
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
__fresh__ key deletion added
parent
3ed64189
Pipeline
#9716
failed with stages
in 2 minutes and 33 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
base.py
redis_cache/backends/base.py
+10
-2
No files found.
redis_cache/backends/base.py
View file @
bf62839f
...
@@ -284,10 +284,14 @@ class BaseRedisCache(BaseCache):
...
@@ -284,10 +284,14 @@ class BaseRedisCache(BaseCache):
@
get_client
(
write
=
True
)
@
get_client
(
write
=
True
)
def
delete
(
self
,
client
,
key
):
def
delete
(
self
,
client
,
key
):
"""Remove a key from the cache."""
"""Remove a key from the cache."""
client
.
delete
(
"__fresh__"
+
key
)
return
client
.
delete
(
key
)
return
client
.
delete
(
key
)
def
_delete_many
(
self
,
client
,
keys
):
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
):
def
delete_many
(
self
,
keys
,
version
=
None
):
"""
"""
...
@@ -360,8 +364,12 @@ class BaseRedisCache(BaseCache):
...
@@ -360,8 +364,12 @@ class BaseRedisCache(BaseCache):
"""
"""
@
get_client
(
write
=
True
)
@
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."""
"""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
)
return
client
.
expire
(
key
,
timeout
)
#####################
#####################
...
...
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