Skip to content

Commit

Permalink
Merge pull request #7893 from dimagi/autodoc
Browse files Browse the repository at this point in the history
Lazily init the cache invalidate pillow
  • Loading branch information
czue committed Aug 20, 2015
2 parents 567725b + 16273b4 commit 33ababa
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions corehq/apps/cachehq/invalidate.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
from corehq.pillows import cacheinvalidate
from dimagi.utils.decorators.memoized import memoized


@memoized
def get_cache_pillow():
return cacheinvalidate.CacheInvalidatePillow()

cache_pillow = cacheinvalidate.CacheInvalidatePillow()

def invalidate_document(document, deleted=False):
"""
Invalidates a document in the cached_core caching framework.
"""
# this is a hack that use the caching pillow invalidation that was intended to be
# rolled out to track this globally.
cache_pillow.change_trigger({
get_cache_pillow().change_trigger({
'doc': document.to_json(),
'id': document._id,
'deleted': deleted,
Expand Down

0 comments on commit 33ababa

Please sign in to comment.