Skip to content

Commit

Permalink
Updating the file watching update to work for referenced object caches.
Browse files Browse the repository at this point in the history
Fixes #627
  • Loading branch information
Zoramite committed Nov 2, 2017
1 parent 904429a commit 87a70b6
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions grow/cache/podcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def reset(self, force=False):
meta['cache'].reset()

def update(self, dep_cache=None, obj_cache=None):
"""Update the values in the dependency cache and/or the object cache."""
if dep_cache:
self._dependency_graph.add_all(dep_cache)

Expand All @@ -132,12 +133,16 @@ def update(self, dep_cache=None, obj_cache=None):
if not key in self._object_caches:
self.create_object_cache(key, **meta)
else:
self._object_caches[key]['cache'].add_all(meta['values'])
self._object_caches[key][
'write_to_file'] = meta['write_to_file']
self._object_caches[key][
'separate_file'] = meta['separate_file']
self._object_caches[key]['can_reset'] = meta['can_reset']
if isinstance(meta, basestring):
# Ignore if the object cache is referenced to a different file.
pass
else:
self._object_caches[key]['cache'].add_all(meta['values'])
self._object_caches[key][
'write_to_file'] = meta['write_to_file']
self._object_caches[key][
'separate_file'] = meta['separate_file']
self._object_caches[key]['can_reset'] = meta['can_reset']

def write(self):
"""Persist the cache information to a yaml file."""
Expand Down

0 comments on commit 87a70b6

Please sign in to comment.