Skip to content

Commit

Permalink
Merge pull request #451 from grow/feature/object-cache
Browse files Browse the repository at this point in the history
Object Cache Default no-reset
  • Loading branch information
Zoramite committed Jun 22, 2017
2 parents 98c37c4 + 23e37ee commit 90e5e0e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion grow/commands/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def build(pod_path, out_dir, preprocess, clear_cache):
out_dir = out_dir or os.path.join(root, 'build')
pod = pods.Pod(root, storage=storage.FileStorage)
if clear_cache:
pod.podcache.reset()
pod.podcache.reset(force=True)
if preprocess:
pod.preprocess()
try:
Expand Down
6 changes: 3 additions & 3 deletions grow/pods/podcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def object_cache(self):
"""Global object cache."""
return self.get_object_cache(self.KEY_GLOBAL)

def create_object_cache(self, key, write_to_file=False, can_reset=True, values=None):
def create_object_cache(self, key, write_to_file=False, can_reset=False, values=None):
"""Create a named object cache."""
self._object_caches[key] = {
'cache': object_cache.ObjectCache(),
Expand All @@ -83,15 +83,15 @@ def has_object_cache(self, key):
"""Has an existing object cache?"""
return key in self._object_caches

def reset(self):
def reset(self, force=False):
"""Reset pod caches."""
self._collection_cache.reset()
self._dependency_graph.reset()
self._document_cache.reset()

# Only reset the object caches if permitted.
for meta in self._object_caches.itervalues():
if meta['can_reset']:
if meta['can_reset'] or force:
meta['cache'].reset()

def write(self):
Expand Down

0 comments on commit 90e5e0e

Please sign in to comment.