def process_doc(self, doc, is_deleted): """ This function does actual cache invalidation. It's also called manually by directly invalidated things. """ doc_id = doc['_id'] if doc_id.startswith('pillowtop_corehq.pillows'): return None # send document to cache invalidation workflow generations_prior = set(self.get_generations()) cache_core.invalidate_doc(doc, deleted=is_deleted) generations_after = set(self.get_generations()) generation_change = generations_prior.symmetric_difference( generations_after) if len(generation_change) > 0: pillow_logging.debug( "[CacheInvalidate]: Change %s (%s), generation change: %s" % (doc_id, doc.get('doc_type', 'unknown'), ', '.join(generation_change))) else: pillow_logging.debug( "[CacheInvalidate]: Change %s (%s), no generation change" % (doc_id, doc.get('doc_type', 'unknown')))
def process_doc(self, doc, is_deleted): """ This function does actual cache invalidation. It's also called manually by directly invalidated things. """ doc_id = doc['_id'] if doc_id.startswith('pillowtop_corehq.pillows'): return None # send document to cache invalidation workflow generations_prior = set(self.get_generations()) cache_core.invalidate_doc(doc, deleted=is_deleted) generations_after = set(self.get_generations()) generation_change = generations_prior.symmetric_difference(generations_after) if len(generation_change) > 0: pillow_logging.debug("[CacheInvalidate]: Change %s (%s), generation change: %s" % ( doc_id, doc.get('doc_type', 'unknown'), ', '.join(generation_change)) ) else: pillow_logging.debug( "[CacheInvalidate]: Change %s (%s), no generation change" % ( doc_id, doc.get('doc_type', 'unknown') ) )
def change_trigger(self, changes_dict): """ This function does actual cache invalidation. It's also called manually by directly invalidated things. """ # requires pillowtop to listen with include_docs doc = changes_dict['doc'] doc_id = doc['_id'] deleted = changes_dict.get('deleted', False) if doc_id.startswith('pillowtop_corehq.pillows'): return None # send document to cache invalidation workflow generations_prior = set(self.get_generations()) cache_core.invalidate_doc(doc, deleted=deleted) generations_after = set(self.get_generations()) generation_change = generations_prior.symmetric_difference( generations_after) if len(generation_change) > 0: pillow_logging.info( "[CacheInvalidate]: Change %s (%s), generation change: %s" % (doc_id, doc.get('doc_type', 'unknown'), ', '.join(generation_change))) else: pillow_logging.info( "[CacheInvalidate]: Change %s (%s), no generation change" % (doc_id, doc.get('doc_type', 'unknown')))
def change_trigger(self, changes_dict): """ This function does actual cache invalidation. It's also called manually by directly invalidated things. """ # requires pillowtop to listen with include_docs doc = changes_dict['doc'] doc_id = doc['_id'] deleted = changes_dict.get('deleted', False) if doc_id.startswith('pillowtop_corehq.pillows'): return None # send document to cache invalidation workflow generations_prior = set(self.get_generations()) cache_core.invalidate_doc(doc, deleted=deleted) generations_after = set(self.get_generations()) generation_change = generations_prior.symmetric_difference(generations_after) if len(generation_change) > 0: pillow_logging.info("[CacheInvalidate]: Change %s (%s), generation change: %s" % (doc_id, doc.get('doc_type', 'unknown'), ', '.join(generation_change))) else: pillow_logging.info("[CacheInvalidate]: Change %s (%s), no generation change" % (doc_id, doc.get('doc_type', 'unknown')))