Fix for _init_cache and _load_source
This commit is contained in:
parent
12c526046f
commit
b73dbd67ce
@ -153,8 +153,14 @@ class property_cache_pickle(object):
|
|||||||
def _init_cache(self):
|
def _init_cache(self):
|
||||||
load_cache = self._load_cache()
|
load_cache = self._load_cache()
|
||||||
uid = self._source_instance.uid() != self._uid()
|
uid = self._source_instance.uid() != self._uid()
|
||||||
|
try:
|
||||||
data_version = self._source_instance.data_version() > self._data_version()
|
data_version = self._source_instance.data_version() > self._data_version()
|
||||||
|
except TypeError:
|
||||||
|
data_version = True
|
||||||
|
try:
|
||||||
storage_version = self._storage_version() != self.STORAGE_VERSION
|
storage_version = self._storage_version() != self.STORAGE_VERSION
|
||||||
|
except TypeError:
|
||||||
|
storage_version = True
|
||||||
#
|
#
|
||||||
if not load_cache or uid or data_version or storage_version:
|
if not load_cache or uid or data_version or storage_version:
|
||||||
if self._uid() is not None and uid:
|
if self._uid() is not None and uid:
|
||||||
@ -188,7 +194,8 @@ class property_cache_pickle(object):
|
|||||||
logger.debug('%s Loading all data from source - %s', self.LOG_PREFIX, repr(self._source_instance.keys()))
|
logger.debug('%s Loading all data from source - %s', self.LOG_PREFIX, repr(self._source_instance.keys()))
|
||||||
for key in self._source_instance.keys():
|
for key in self._source_instance.keys():
|
||||||
val = self._source_instance.get(key)
|
val = self._source_instance.get(key)
|
||||||
self._cached_props[self._key_filter(key)] = val
|
self._cached_props[self.DATA_TAG][self._key_filter(key)] = val
|
||||||
|
self._cached_props[self.AGE_TAG][self._key_filter(key)] = int(time.time())
|
||||||
|
|
||||||
def _save_cache(self):
|
def _save_cache(self):
|
||||||
with open(self._cache_filename, 'wb') as fh:
|
with open(self._cache_filename, 'wb') as fh:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user