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
d6b357de
Commit
d6b357de
authored
Jul 07, 2011
by
Ales Zoulek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
call set_many in pipeline
parent
df5d6063
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
cache.py
redis_cache/cache.py
+6
-7
No files found.
redis_cache/cache.py
View file @
d6b357de
...
...
@@ -113,10 +113,12 @@ class CacheClass(BaseCache):
return
default
return
self
.
unpickle
(
value
)
def
set
(
self
,
key
,
value
,
timeout
=
None
,
version
=
None
):
def
set
(
self
,
key
,
value
,
timeout
=
None
,
version
=
None
,
client
=
None
):
"""
Persist a value to the cache, and set an optional expiration time.
"""
if
not
client
:
client
=
self
.
_cache
key
=
self
.
make_key
(
key
,
version
=
version
)
# get timout
if
not
timeout
:
...
...
@@ -190,13 +192,10 @@ class CacheClass(BaseCache):
If timeout is given, that timeout will be used for the key; otherwise
the default cache timeout will be used.
"""
safe_data
=
{}
pipeline
=
self
.
_cache
.
pipeline
()
for
key
,
value
in
data
.
iteritems
():
safe_data
[
key
]
=
pickle
.
dumps
(
value
)
if
safe_data
:
self
.
_cache
.
mset
(
dict
((
self
.
make_key
(
key
,
version
=
version
),
value
)
for
key
,
value
in
safe_data
.
iteritems
()))
map
(
self
.
expire
,
safe_data
,
[
timeout
]
*
len
(
safe_data
))
self
.
set
(
key
,
value
,
timeout
,
version
=
version
,
client
=
pipeline
)
pipeline
.
execute
()
class
RedisCache
(
CacheClass
):
...
...
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