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
7361e20c
Commit
7361e20c
authored
Jul 22, 2011
by
James Aylett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make cache object picklable.
parent
6504a3d4
Show 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 @
7361e20c
...
@@ -37,7 +37,11 @@ class CacheClass(BaseCache):
...
@@ -37,7 +37,11 @@ class CacheClass(BaseCache):
"""
"""
Connect to Redis, and set up cache backend.
Connect to Redis, and set up cache backend.
"""
"""
self
.
_init
(
server
,
params
)
def
_init
(
self
,
server
,
params
):
super
(
CacheClass
,
self
)
.
__init__
(
params
)
super
(
CacheClass
,
self
)
.
__init__
(
params
)
self
.
_initargs
=
{
'server'
:
server
,
'params'
:
params
}
options
=
params
.
get
(
'OPTIONS'
,
{})
options
=
params
.
get
(
'OPTIONS'
,
{})
password
=
params
.
get
(
'password'
,
options
.
get
(
'PASSWORD'
,
None
))
password
=
params
.
get
(
'password'
,
options
.
get
(
'PASSWORD'
,
None
))
db
=
params
.
get
(
'db'
,
options
.
get
(
'DB'
,
1
))
db
=
params
.
get
(
'db'
,
options
.
get
(
'DB'
,
1
))
...
@@ -56,6 +60,12 @@ class CacheClass(BaseCache):
...
@@ -56,6 +60,12 @@ class CacheClass(BaseCache):
port
=
6379
port
=
6379
self
.
_client
=
redis
.
Redis
(
host
=
host
,
port
=
port
,
db
=
db
,
password
=
password
)
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
):
def
make_key
(
self
,
key
,
version
=
None
):
"""
"""
Returns the utf-8 encoded bytestring of the given key as a CacheKey
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