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
a52dcb66
Commit
a52dcb66
authored
Jul 07, 2011
by
Ales Zoulek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No need for expiration function
parent
d6b357de
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
32 deletions
+0
-32
cache.py
redis_cache/cache.py
+0
-11
tests.py
tests/testapp/tests.py
+0
-21
No files found.
redis_cache/cache.py
View file @
a52dcb66
...
@@ -128,17 +128,6 @@ class CacheClass(BaseCache):
...
@@ -128,17 +128,6 @@ class CacheClass(BaseCache):
# result is a boolean
# result is a boolean
return
result
return
result
def
expire
(
self
,
key
,
timeout
=
None
,
version
=
None
):
"""
Set content expiration, if necessary
"""
key
=
self
.
make_key
(
key
,
version
=
version
)
if
not
timeout
:
timeout
=
self
.
default_timeout
# If the expiration command returns false, we need to reset the key
# with the new expiration
self
.
_cache
.
expire
(
key
,
timeout
)
def
delete
(
self
,
key
,
version
=
None
):
def
delete
(
self
,
key
,
version
=
None
):
"""
"""
Remove a key from the cache.
Remove a key from the cache.
...
...
tests/testapp/tests.py
View file @
a52dcb66
...
@@ -195,27 +195,6 @@ class RedisCacheTests(TestCase):
...
@@ -195,27 +195,6 @@ class RedisCacheTests(TestCase):
self
.
cache
.
set
(
key
,
value
);
self
.
cache
.
set
(
key
,
value
);
self
.
assertTrue
(
self
.
cache
.
_cache
.
ttl
(
key
)
>
0
)
self
.
assertTrue
(
self
.
cache
.
_cache
.
ttl
(
key
)
>
0
)
def
test_set_expiration_first_expire_call
(
self
):
key
,
value
=
self
.
cache
.
make_key
(
'key'
),
'value'
# bypass public set api so we don't set the expiration
self
.
cache
.
_cache
.
set
(
key
,
pickle
.
dumps
(
value
))
self
.
cache
.
expire
(
'key'
,
1
)
time
.
sleep
(
2
)
self
.
assertEqual
(
self
.
cache
.
get
(
'key'
),
None
)
def
test_set_expiration_mulitple_expire_calls
(
self
):
key
,
value
=
'key'
,
'value'
self
.
cache
.
set
(
key
,
value
,
1
)
time
.
sleep
(
2
)
self
.
assertEqual
(
self
.
cache
.
get
(
'key'
),
None
)
self
.
cache
.
set
(
key
,
value
,
100
)
self
.
assertEqual
(
self
.
cache
.
get
(
'key'
),
value
)
time
.
sleep
(
2
)
self
.
assertEqual
(
self
.
cache
.
get
(
'key'
),
value
)
self
.
cache
.
expire
(
key
,
1
)
time
.
sleep
(
2
)
self
.
assertEqual
(
self
.
cache
.
get
(
'key'
),
None
)
def
test_unicode
(
self
):
def
test_unicode
(
self
):
# Unicode values can be cached
# Unicode values can be cached
stuff
=
{
stuff
=
{
...
...
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