Skip to content

Commit

Permalink
Merge pull request #98 from chripede/master
Browse files Browse the repository at this point in the history
RedisDummyCache
  • Loading branch information
sebleier committed Aug 10, 2015
2 parents 9d53ad1 + a15b253 commit 7c0b0d6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions redis_cache/__init__.py
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
24 changes: 24 additions & 0 deletions redis_cache/backends/dummy.py
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

0 comments on commit 7c0b0d6

Please sign in to comment.