##// END OF EJS Templates
caches: use a faster LRUDict implementation for LRUMemoryCache
marcink -
r2882:7c75e32b default
parent child Browse files
Show More
@@ -791,6 +791,17 b' self: super: {'
791 791 license = [ pkgs.lib.licenses.bsdOriginal ];
792 792 };
793 793 };
794 "lru-dict" = super.buildPythonPackage {
795 name = "lru-dict-1.1.6";
796 doCheck = false;
797 src = fetchurl {
798 url = "https://files.pythonhosted.org/packages/00/a5/32ed6e10246cd341ca8cc205acea5d208e4053f48a4dced2b1b31d45ba3f/lru-dict-1.1.6.tar.gz";
799 sha256 = "1k2lhd4dpl6xa6iialbwx4l6bkdzxmzhygms39pvf19x1rk5fm1n";
800 };
801 meta = {
802 license = [ pkgs.lib.licenses.mit ];
803 };
804 };
794 805 "lxml" = super.buildPythonPackage {
795 806 name = "lxml-3.7.3";
796 807 doCheck = false;
@@ -1668,6 +1679,7 b' self: super: {'
1668 1679 self."billiard"
1669 1680 self."kombu"
1670 1681 self."lxml"
1682 self."lru-dict"
1671 1683 self."mako"
1672 1684 self."markdown"
1673 1685 self."markupsafe"
@@ -29,6 +29,7 b' jinja2==2.9.6'
29 29 billiard==3.5.0.3
30 30 kombu==4.2.0
31 31 lxml==3.7.3
32 lru-dict==1.1.6
32 33 mako==1.0.7
33 34 markdown==2.6.11
34 35 markupsafe==1.0.0
@@ -28,8 +28,8 b' from dogpile.cache.backends import file '
28 28 from dogpile.cache.backends import redis as redis_backend
29 29 from dogpile.cache.backends.file import NO_VALUE, compat, FileLock
30 30 from dogpile.cache.util import memoized_property
31 from lru import LRU as LRUDict
31 32
32 from rhodecode.lib.memory_lru_debug import LRUDict
33 33
34 34 _default_max_size = 1024
35 35
@@ -37,12 +37,22 b' log = logging.getLogger(__name__)'
37 37
38 38
39 39 class LRUMemoryBackend(memory_backend.MemoryBackend):
40 pickle_values = False
40 41
41 42 def __init__(self, arguments):
42 43 max_size = arguments.pop('max_size', _default_max_size)
43 44 arguments['cache_dict'] = LRUDict(max_size)
44 45 super(LRUMemoryBackend, self).__init__(arguments)
45 46
47 def delete(self, key):
48 if self._cache.has_key(key):
49 del self._cache[key]
50
51 def delete_multi(self, keys):
52 for key in keys:
53 if self._cache.has_key(key):
54 del self._cache[key]
55
46 56
47 57 class Serializer(object):
48 58 def _dumps(self, value):
General Comments 0
You need to be logged in to leave comments. Login now