##// END OF EJS Templates
caches: turn off thread scoped caches, and allow .ini override. Thread scoped caches are only usefull for development on using pserve
marcink -
r2935:47998ee0 default
parent child Browse files
Show More
@@ -27,7 +27,7 b' from dogpile.cache.util import compat'
27 27
28 28 import rhodecode
29 29 from rhodecode.lib.utils import safe_str, sha1
30 from rhodecode.lib.utils2 import safe_unicode
30 from rhodecode.lib.utils2 import safe_unicode, str2bool
31 31 from rhodecode.model.db import Session, CacheKey, IntegrityError
32 32
33 33 from . import region_meta
@@ -249,16 +249,20 b' class InvalidationContext(object):'
249 249 safe_str(self.cache_key), safe_str(self.uid))
250 250
251 251 def __init__(self, uid, invalidation_namespace='',
252 raise_exception=False, thread_scoped=True):
252 raise_exception=False, thread_scoped=None):
253 253 self.uid = uid
254 254 self.invalidation_namespace = invalidation_namespace
255 255 self.raise_exception = raise_exception
256 256 self.proc_id = safe_unicode(rhodecode.CONFIG.get('instance_id') or 'DEFAULT')
257 257 self.thread_id = 'global'
258 258
259 if thread_scoped is None:
260 # if we set "default" we can override this via .ini settings
261 thread_scoped = str2bool(rhodecode.CONFIG.get('cache_thread_scoped'))
262
259 263 # Append the thread id to the cache key if this invalidation context
260 264 # should be scoped to the current thread.
261 if thread_scoped:
265 if thread_scoped is True:
262 266 self.thread_id = threading.current_thread().ident
263 267
264 268 self.cache_key = compute_key_from_params(uid)
General Comments 0
You need to be logged in to leave comments. Login now