-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #98 from chripede/master
RedisDummyCache
- Loading branch information
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from redis_cache.backends.single import RedisCache | ||
from redis_cache.backends.multiple import ShardedRedisCache | ||
from redis_cache.backends.dummy import RedisDummyCache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from django.core.cache.backends.dummy import DummyCache | ||
|
||
|
||
class RedisDummyCache(DummyCache): | ||
def ttl(self, key): | ||
return 0 | ||
|
||
def delete_pattern(self, pattern, version=None): | ||
return None | ||
|
||
def get_or_set(self, key, func, timeout=None): | ||
if not callable(func): | ||
raise Exception("Must pass in a callable") | ||
|
||
return func() | ||
|
||
def reinsert_keys(self): | ||
return None | ||
|
||
def persist(self, key): | ||
return True | ||
|
||
def expire(self, key, timeout): | ||
return True |