Show More
@@ -36,13 +36,32 b' eg difference in speed:' | |||
|
36 | 36 | """ |
|
37 | 37 | import logging |
|
38 | 38 | |
|
39 | from infrae.cache.beakerext.lru import LRUDict | |
|
39 | from repoze.lru import LRUCache | |
|
40 | 40 | from beaker.container import MemoryNamespaceManager, AbstractDictionaryNSManager |
|
41 | 41 | from rhodecode.lib.utils2 import safe_str |
|
42 | 42 | |
|
43 | 43 | log = logging.getLogger(__name__) |
|
44 | 44 | |
|
45 | 45 | |
|
46 | class LRUDict(LRUCache): | |
|
47 | """ Wrapper to provide partial dict access | |
|
48 | """ | |
|
49 | def __setitem__(self, key, value): | |
|
50 | return self.put(key, value) | |
|
51 | ||
|
52 | def __getitem__(self, key): | |
|
53 | return self.get(key) | |
|
54 | ||
|
55 | def __contains__(self, key): | |
|
56 | return bool(self.get(key)) | |
|
57 | ||
|
58 | def __delitem__(self, key): | |
|
59 | del self.data[key] | |
|
60 | ||
|
61 | def keys(self): | |
|
62 | return self.data.keys() | |
|
63 | ||
|
64 | ||
|
46 | 65 | class LRUDictDebug(LRUDict): |
|
47 | 66 | """ |
|
48 | 67 | Wrapper to provide some debug options |
General Comments 0
You need to be logged in to leave comments.
Login now