/django/core/cache/backends/dummy.py
https://code.google.com/p/mango-py/ · Python · 46 lines · 33 code · 12 blank · 1 comment · 0 complexity · e76797cc69af3c95f1eaec5e18eec86f MD5 · raw file
- "Dummy cache backend"
- from django.core.cache.backends.base import BaseCache
- class DummyCache(BaseCache):
- def __init__(self, host, *args, **kwargs):
- BaseCache.__init__(self, *args, **kwargs)
- def add(self, key, value, timeout=None, version=None):
- key = self.make_key(key, version=version)
- self.validate_key(key)
- return True
- def get(self, key, default=None, version=None):
- key = self.make_key(key, version=version)
- self.validate_key(key)
- return default
- def set(self, key, value, timeout=None, version=None):
- key = self.make_key(key, version=version)
- self.validate_key(key)
- def delete(self, key, version=None):
- key = self.make_key(key, version=version)
- self.validate_key(key)
- def get_many(self, keys, version=None):
- return {}
- def has_key(self, key, version=None):
- key = self.make_key(key, version=version)
- self.validate_key(key)
- return False
- def set_many(self, data, version=None):
- pass
- def delete_many(self, keys, version=None):
- pass
- def clear(self):
- pass
- # For backwards compatibility
- class CacheClass(DummyCache):
- pass