Example #1
0
 def model_flush_key(cls):
     """
     Return a cache key for the entire model (used by invalidation).
     """
     # use dummy PK and DB reference that will never resolve to an actual
     # cache key for an object
     return flush_key(cls._cache_key('all-pks', 'all-dbs'))
Example #2
0
 def cache_objects(self, objects, query_key):
     """Cache query_key => objects, then update the flush lists."""
     log.debug('query_key: %s' % query_key)
     query_flush = flush_key(self.queryset.query_key())
     log.debug('query_flush: %s' % query_flush)
     cache.add(query_key, objects, timeout=self.timeout)
     invalidator.cache_objects(self.queryset.model, objects, query_key, query_flush)
Example #3
0
 def flush_key(self):
     return flush_key(self)
Example #4
0
 def flush_key(self):
     return flush_key(self.query_key())