2006-02-24 14:07:01 +08:00
|
|
|
"Dummy cache backend"
|
|
|
|
|
|
|
|
from django.core.cache.backends.base import BaseCache
|
|
|
|
|
2010-12-21 23:19:19 +08:00
|
|
|
class DummyCache(BaseCache):
|
2010-11-19 23:39:35 +08:00
|
|
|
def __init__(self, host, *args, **kwargs):
|
|
|
|
BaseCache.__init__(self, *args, **kwargs)
|
2006-02-24 14:07:01 +08:00
|
|
|
|
2010-11-19 23:39:35 +08:00
|
|
|
def add(self, key, value, timeout=None, version=None):
|
|
|
|
key = self.make_key(key, version=version)
|
2010-09-13 02:45:26 +08:00
|
|
|
self.validate_key(key)
|
2008-08-10 11:52:21 +08:00
|
|
|
return True
|
2007-10-20 23:16:34 +08:00
|
|
|
|
2010-11-19 23:39:35 +08:00
|
|
|
def get(self, key, default=None, version=None):
|
|
|
|
key = self.make_key(key, version=version)
|
2010-09-13 02:45:26 +08:00
|
|
|
self.validate_key(key)
|
2007-01-12 23:16:55 +08:00
|
|
|
return default
|
2006-02-24 14:07:01 +08:00
|
|
|
|
2010-11-19 23:39:35 +08:00
|
|
|
def set(self, key, value, timeout=None, version=None):
|
|
|
|
key = self.make_key(key, version=version)
|
2010-09-13 02:45:26 +08:00
|
|
|
self.validate_key(key)
|
2006-02-24 14:07:01 +08:00
|
|
|
|
2010-11-19 23:39:35 +08:00
|
|
|
def delete(self, key, version=None):
|
|
|
|
key = self.make_key(key, version=version)
|
2010-09-13 02:45:26 +08:00
|
|
|
self.validate_key(key)
|
2006-02-24 14:07:01 +08:00
|
|
|
|
2010-11-19 23:39:35 +08:00
|
|
|
def get_many(self, keys, version=None):
|
2007-01-12 23:16:55 +08:00
|
|
|
return {}
|
2006-02-24 14:07:01 +08:00
|
|
|
|
2010-11-19 23:39:35 +08:00
|
|
|
def has_key(self, key, version=None):
|
|
|
|
key = self.make_key(key, version=version)
|
2010-09-13 02:45:26 +08:00
|
|
|
self.validate_key(key)
|
2006-02-24 14:07:01 +08:00
|
|
|
return False
|
2010-01-27 16:21:35 +08:00
|
|
|
|
2011-09-11 01:09:23 +08:00
|
|
|
def set_many(self, data, timeout=0, version=None):
|
2010-01-27 16:21:35 +08:00
|
|
|
pass
|
|
|
|
|
2010-11-19 23:39:35 +08:00
|
|
|
def delete_many(self, keys, version=None):
|
2010-01-27 16:21:35 +08:00
|
|
|
pass
|
|
|
|
|
|
|
|
def clear(self):
|
|
|
|
pass
|
2010-12-21 23:19:19 +08:00
|
|
|
|
|
|
|
# For backwards compatibility
|
|
|
|
class CacheClass(DummyCache):
|
|
|
|
pass
|