This example from documentation:
class City(models.Model): # ... field declarations
objects = CityManager() # an example how to cache django model methods by instance id def has_offers(self): @cached(30) def offer_count(pk): return self.offer_set.count() return history_count(self.pk) > 0
has 2 issues.
I think the last line should be: return offer_count(self.pk) > 0
How to invalidate the cached method offer_count() ? I mean what is the syntax? An example would be very helpfull