##// 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 import rhodecode
28 import rhodecode
29 from rhodecode.lib.utils import safe_str, sha1
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 from rhodecode.model.db import Session, CacheKey, IntegrityError
31 from rhodecode.model.db import Session, CacheKey, IntegrityError
32
32
33 from . import region_meta
33 from . import region_meta
@@ -249,16 +249,20 b' class InvalidationContext(object):'
249 safe_str(self.cache_key), safe_str(self.uid))
249 safe_str(self.cache_key), safe_str(self.uid))
250
250
251 def __init__(self, uid, invalidation_namespace='',
251 def __init__(self, uid, invalidation_namespace='',
252 raise_exception=False, thread_scoped=True):
252 raise_exception=False, thread_scoped=None):
253 self.uid = uid
253 self.uid = uid
254 self.invalidation_namespace = invalidation_namespace
254 self.invalidation_namespace = invalidation_namespace
255 self.raise_exception = raise_exception
255 self.raise_exception = raise_exception
256 self.proc_id = safe_unicode(rhodecode.CONFIG.get('instance_id') or 'DEFAULT')
256 self.proc_id = safe_unicode(rhodecode.CONFIG.get('instance_id') or 'DEFAULT')
257 self.thread_id = 'global'
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 # Append the thread id to the cache key if this invalidation context
263 # Append the thread id to the cache key if this invalidation context
260 # should be scoped to the current thread.
264 # should be scoped to the current thread.
261 if thread_scoped:
265 if thread_scoped is True:
262 self.thread_id = threading.current_thread().ident
266 self.thread_id = threading.current_thread().ident
263
267
264 self.cache_key = compute_key_from_params(uid)
268 self.cache_key = compute_key_from_params(uid)
General Comments 0
You need to be logged in to leave comments. Login now