separate Cache from values and settings

This commit is contained in:
2019-08-01 18:22:18 +02:00
parent c5ce9be699
commit 1691e38db5
16 changed files with 348 additions and 313 deletions

View File

@ -196,7 +196,7 @@ class ConfigBag:
def __getattr__(self, key):
if key == 'properties':
settings = self.context.cfgimpl_get_settings()
self.properties = settings.get_context_properties()
self.properties = settings.get_context_properties(self.context._impl_properties_cache)
return self.properties
if key == 'permissives':
settings = self.context.cfgimpl_get_settings()
@ -390,22 +390,23 @@ class Settings(object):
# ____________________________________________________________
# get properties and permissive methods
def get_context_properties(self):
is_cached, props, validated = self._p_.getcache(None,
None,
None,
{},
{},
'context_props')
def get_context_properties(self,
cache):
is_cached, props, validated = cache.getcache(None,
None,
None,
{},
{},
'context_props')
if not is_cached:
props = self._p_.getproperties(None,
self.default_properties)
self._p_.setcache(None,
None,
props,
{},
props,
True)
cache.setcache(None,
None,
props,
{},
props,
True)
return props
def getproperties(self,
@ -423,13 +424,14 @@ class Settings(object):
path = opt.impl_getpath()
if apply_requires:
cache = config_bag.context._impl_properties_cache
props = config_bag.properties
is_cached, props, validated = self._p_.getcache(path,
config_bag.expiration_time,
index,
props,
{},
'self_props')
is_cached, props, validated = cache.getcache(path,
config_bag.expiration_time,
index,
props,
{},
'self_props')
else:
is_cached = False
if not is_cached:
@ -443,12 +445,12 @@ class Settings(object):
path)
#if apply_requires and config_bag.properties == config_bag.true_properties:
if apply_requires and not config_bag.is_unrestraint:
self._p_.setcache(path,
index,
props,
props,
config_bag.properties,
True)
cache.setcache(path,
index,
props,
props,
config_bag.properties,
True)
return props
def get_context_permissives(self):