Skip to content

Commit

Permalink
Lazily init the cache invalidate pillow
Browse files Browse the repository at this point in the history
  • Loading branch information
esoergel committed Aug 17, 2015
1 parent b3888ad commit 16273b4
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 16273b4

Please sign in to comment.