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
ff58e470
Commit
ff58e470
authored
Jul 22, 2011
by
Sean Bleier
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #19 from jaylett/picklable-cache-object
Make cache object picklable.
parents
6504a3d4
7361e20c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
cache.py
redis_cache/cache.py
+10
-0
No files found.
redis_cache/cache.py
View file @
ff58e470
...
...
@@ -37,7 +37,11 @@ class CacheClass(BaseCache):
"""
Connect to Redis, and set up cache backend.
"""
self
.
_init
(
server
,
params
)
def
_init
(
self
,
server
,
params
):
super
(
CacheClass
,
self
)
.
__init__
(
params
)
self
.
_initargs
=
{
'server'
:
server
,
'params'
:
params
}
options
=
params
.
get
(
'OPTIONS'
,
{})
password
=
params
.
get
(
'password'
,
options
.
get
(
'PASSWORD'
,
None
))
db
=
params
.
get
(
'db'
,
options
.
get
(
'DB'
,
1
))
...
...
@@ -56,6 +60,12 @@ class CacheClass(BaseCache):
port
=
6379
self
.
_client
=
redis
.
Redis
(
host
=
host
,
port
=
port
,
db
=
db
,
password
=
password
)
def
__getstate__
(
self
):
return
self
.
_initargs
def
__setstate__
(
self
,
state
):
self
.
_init
(
**
state
)
def
make_key
(
self
,
key
,
version
=
None
):
"""
Returns the utf-8 encoded bytestring of the given key as a CacheKey
...
...
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