OLD | NEW |
(Empty) | |
| 1 """ |
| 2 Null Backend |
| 3 ------------- |
| 4 |
| 5 The Null backend does not do any caching at all. It can be |
| 6 used to test behavior without caching, or as a means of disabling |
| 7 caching for a region that is otherwise used normally. |
| 8 |
| 9 .. versionadded:: 0.5.4 |
| 10 |
| 11 """ |
| 12 |
| 13 from ..api import CacheBackend, NO_VALUE |
| 14 |
| 15 |
| 16 __all__ = ['NullBackend'] |
| 17 |
| 18 |
| 19 class NullLock(object): |
| 20 def acquire(self, wait=True): |
| 21 return True |
| 22 |
| 23 def release(self): |
| 24 pass |
| 25 |
| 26 |
| 27 class NullBackend(CacheBackend): |
| 28 """A "null" backend that effectively disables all cache operations. |
| 29 |
| 30 Basic usage:: |
| 31 |
| 32 from dogpile.cache import make_region |
| 33 |
| 34 region = make_region().configure( |
| 35 'dogpile.cache.null' |
| 36 ) |
| 37 |
| 38 """ |
| 39 |
| 40 def __init__(self, arguments): |
| 41 pass |
| 42 |
| 43 def get_mutex(self, key): |
| 44 return NullLock() |
| 45 |
| 46 def get(self, key): |
| 47 return NO_VALUE |
| 48 |
| 49 def get_multi(self, keys): |
| 50 return [NO_VALUE for k in keys] |
| 51 |
| 52 def set(self, key, value): |
| 53 pass |
| 54 |
| 55 def set_multi(self, mapping): |
| 56 pass |
| 57 |
| 58 def delete(self, key): |
| 59 pass |
| 60 |
| 61 def delete_multi(self, keys): |
| 62 pass |
OLD | NEW |