caches: turn off thread scoped caches, and allow .ini override. Thread scoped caches are only usefull for development on using pserve
This commit is contained in:
parent
6b38c098b5
commit
64ee0ddc8f
1 changed files with 7 additions and 3 deletions
|
|
@ -27,7 +27,7 @@ from dogpile.cache.util import compat
|
|||
|
||||
import rhodecode
|
||||
from rhodecode.lib.utils import safe_str, sha1
|
||||
from rhodecode.lib.utils2 import safe_unicode
|
||||
from rhodecode.lib.utils2 import safe_unicode, str2bool
|
||||
from rhodecode.model.db import Session, CacheKey, IntegrityError
|
||||
|
||||
from . import region_meta
|
||||
|
|
@ -249,16 +249,20 @@ class InvalidationContext(object):
|
|||
safe_str(self.cache_key), safe_str(self.uid))
|
||||
|
||||
def __init__(self, uid, invalidation_namespace='',
|
||||
raise_exception=False, thread_scoped=True):
|
||||
raise_exception=False, thread_scoped=None):
|
||||
self.uid = uid
|
||||
self.invalidation_namespace = invalidation_namespace
|
||||
self.raise_exception = raise_exception
|
||||
self.proc_id = safe_unicode(rhodecode.CONFIG.get('instance_id') or 'DEFAULT')
|
||||
self.thread_id = 'global'
|
||||
|
||||
if thread_scoped is None:
|
||||
# if we set "default" we can override this via .ini settings
|
||||
thread_scoped = str2bool(rhodecode.CONFIG.get('cache_thread_scoped'))
|
||||
|
||||
# Append the thread id to the cache key if this invalidation context
|
||||
# should be scoped to the current thread.
|
||||
if thread_scoped:
|
||||
if thread_scoped is True:
|
||||
self.thread_id = threading.current_thread().ident
|
||||
|
||||
self.cache_key = compute_key_from_params(uid)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue