def delete_docs(cls, docs, all_or_nothing=False, empty_on_delete=False): super(_InvalidateCacheMixin, cls).bulk_delete(docs, all_or_nothing=all_or_nothing, empty_on_delete=empty_on_delete) for doc in docs: doc.clear_caches() invalidate_document(doc, deleted=True)
def delete(self): id = self._id try: super(CachedCouchDocumentMixin, self).delete() except ResourceNotFound: # it was already deleted. this isn't a problem, but might be a caching bug logging.exception('Tried to delete cached doc %s but it was already deleted' % id) self._doc['_id'] = id invalidate_document(self, deleted=True)
def delete(self): id = self._id try: super(_InvalidateCacheMixin, self).delete() except ResourceNotFound: # it was already deleted. this isn't a problem, but might be a caching bug logging.exception('Tried to delete cached doc %s but it was already deleted', id) self._doc['_id'] = id self.clear_caches() invalidate_document(self, couch_db=self.get_db(), deleted=True)
def save_docs(cls, docs, use_uuids=True, all_or_nothing=False): super(CachedCouchDocumentMixin, cls).save_docs(docs, use_uuids, all_or_nothing) for doc in docs: invalidate_document(doc)
def save(self, **params): super(CachedCouchDocumentMixin, self).save(**params) invalidate_document(self)
def invalidate_cached_domain(sender, domain, **kwargs): invalidate_document(domain)
def invalidate_cached_user(sender, couch_user, **kwargs): invalidate_document(couch_user)
def clear_caches(self): invalidate_document(self)
def clear_caches(self): invalidate_document(self, couch_db=self.get_db())
def delete_docs(cls, docs, all_or_nothing=False, empty_on_delete=False): super(_InvalidateCacheMixin, cls).bulk_delete( docs, all_or_nothing=all_or_nothing, empty_on_delete=empty_on_delete) for doc in docs: doc.clear_caches() invalidate_document(doc, couch_db=cls.get_db(), deleted=True)
def delete_docs(cls, docs, empty_on_delete=False): super(_InvalidateCacheMixin, cls).bulk_delete( docs, empty_on_delete=empty_on_delete) for doc in docs: doc.clear_caches() invalidate_document(doc, deleted=True)
def invalidate_cached_domain(sender, domain, **kwargs): invalidate_document(domain, couch_db=domain.get_db())