save indexed value in cache is not necessary
This commit is contained in:
@ -382,7 +382,7 @@ class Settings(object):
|
||||
if opt is None:
|
||||
ntime = int(time())
|
||||
if self._p_.hascache(path, index):
|
||||
is_cached, props = self._p_.getcache(path, ntime, index)
|
||||
is_cached, props = self._p_.getcache(path, ntime, None)
|
||||
else:
|
||||
is_cached = False
|
||||
if not is_cached or 'cache' not in props:
|
||||
@ -396,7 +396,7 @@ class Settings(object):
|
||||
ntime = ntime + expires_time
|
||||
else:
|
||||
ntime = None
|
||||
self._p_.setcache(path, props, ntime, index)
|
||||
self._p_.setcache(path, props, ntime, None)
|
||||
else:
|
||||
if path is None: # pragma: optional cover
|
||||
raise ValueError(_('if opt is not None, path should not be'
|
||||
|
@ -245,7 +245,9 @@ class Values(object):
|
||||
_orig_context is undefined:
|
||||
if 'expire' in setting_properties:
|
||||
ntime = int(time())
|
||||
is_cached, value = self._p_.getcache(path, ntime, index)
|
||||
is_cached, value = self._p_.getcache(path, ntime, None)
|
||||
if index:
|
||||
value = value[index]
|
||||
if is_cached:
|
||||
if opt.impl_is_multi() and not isinstance(value, Multi) and index is None:
|
||||
value = Multi(value, self.context, opt, path)
|
||||
@ -290,14 +292,14 @@ class Values(object):
|
||||
if isinstance(val, Exception):
|
||||
return val
|
||||
# cache doesn't work with SubMulti yet
|
||||
if not isinstance(val, SubMulti) and 'cache' in setting_properties and \
|
||||
if not index and not isinstance(val, SubMulti) and 'cache' in setting_properties and \
|
||||
validate and validate_properties and force_permissive is False \
|
||||
and trusted_cached_properties is True and _orig_context is undefined:
|
||||
if 'expire' in setting_properties:
|
||||
if ntime is None:
|
||||
ntime = int(time())
|
||||
ntime = ntime + expires_time
|
||||
self._p_.setcache(path, val, ntime, index)
|
||||
self._p_.setcache(path, val, ntime, None)
|
||||
return val
|
||||
|
||||
def _get_validated_value(self, opt, path, validate, force_permissive,
|
||||
|
Reference in New Issue
Block a user