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
2867c78f
Commit
2867c78f
authored
Dec 01, 2020
by
Tomi Suomela
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cache: getset() and incrby() added
parent
74b834c6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
base.py
redis_cache/backends/base.py
+16
-0
No files found.
redis_cache/backends/base.py
View file @
2867c78f
...
...
@@ -546,3 +546,19 @@ class BaseRedisCache(BaseCache):
def
has_fresh_key
(
self
,
client
,
key
):
"""Returns True if the fresh key is in the cache and has not expired."""
return
client
.
exists
(
"__fresh__"
+
key
)
@
get_client
(
write
=
True
)
def
getset
(
self
,
client
,
key
,
value
):
"""
Sets the value at key ``name`` to ``value``
and returns the old value at key ``name`` atomically.
"""
return
client
.
getset
(
key
,
value
)
@
get_client
(
write
=
True
)
def
incrby
(
self
,
client
,
key
,
amount
=
1
):
"""
Increments the value of ``key`` by ``amount``. If no key exists,
the value will be initialized as ``amount``
"""
return
client
.
incrby
(
key
,
amount
=
1
)
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