##// END OF EJS Templates
caches: synced with CE changes
super-admin -
r1127:367165a5 python3
parent child Browse files
Show More
@@ -18,13 +18,28 b''
18 import logging
18 import logging
19 import os
19 import os
20 import diskcache
20 import diskcache
21 from diskcache import RLock
21
22
22 log = logging.getLogger(__name__)
23 log = logging.getLogger(__name__)
23
24
24 cache_meta = None
25 cache_meta = None
25
26
26
27
28 class ReentrantLock(RLock):
29 def __enter__(self):
30 reentrant_lock_key = self._key
31
32 log.debug('Acquire ReentrantLock(key=%s) for archive cache generation...', reentrant_lock_key)
33 #self.acquire()
34 log.debug('Lock for key=%s acquired', reentrant_lock_key)
35
36 def __exit__(self, *exc_info):
37 #self.release()
38 pass
39
40
27 def get_archival_config(config):
41 def get_archival_config(config):
42
28 final_config = {
43 final_config = {
29 'archive_cache.eviction_policy': 'least-frequently-used'
44 'archive_cache.eviction_policy': 'least-frequently-used'
30 }
45 }
@@ -24,10 +24,12 b' import time'
24 import decorator
24 import decorator
25 from dogpile.cache import CacheRegion
25 from dogpile.cache import CacheRegion
26
26
27 from vcsserver.lib.rc_cache import region_meta
27
28 from vcsserver.utils import sha1
28 from vcsserver.str_utils import safe_bytes
29 from vcsserver.str_utils import safe_bytes
29 from vcsserver.type_utils import str2bool
30 from vcsserver.type_utils import str2bool
30 from vcsserver.utils import sha1
31
32 from . import region_meta
31
33
32 log = logging.getLogger(__name__)
34 log = logging.getLogger(__name__)
33
35
@@ -164,8 +166,9 b' def backend_key_generator(backend):'
164 return wrapper
166 return wrapper
165
167
166
168
167 def get_or_create_region(region_name, region_namespace: str = None):
169 def get_or_create_region(region_name, region_namespace: str = None, use_async_runner=False):
168 from vcsserver.lib.rc_cache.backends import FileNamespaceBackend
170 from .backends import FileNamespaceBackend
171 from . import async_creation_runner
169
172
170 region_obj = region_meta.dogpile_cache_regions.get(region_name)
173 region_obj = region_meta.dogpile_cache_regions.get(region_name)
171 if not region_obj:
174 if not region_obj:
@@ -215,6 +218,8 b' def get_or_create_region(region_name, re'
215 region_obj = region_meta.dogpile_cache_regions[region_namespace] = new_region
218 region_obj = region_meta.dogpile_cache_regions[region_namespace] = new_region
216
219
217 region_obj._default_namespace = region_namespace
220 region_obj._default_namespace = region_namespace
221 if use_async_runner:
222 region_obj.async_creation_runner = async_creation_runner
218 return region_obj
223 return region_obj
219
224
220
225
General Comments 0
You need to be logged in to leave comments. Login now