Matt
Matt

Reputation: 3652

Django Cache Machine: Enabling QuerySet caching on third-party or core Models

I'm using Cache Machine to cache QuerySets which involves adding this to your model:

class MyModel(CachingMixin, models.Model):
    objects = CachingManager()

How can I apply this caching to Models I don't have access to? e.g. User or third-party modules.

Upvotes: 1

Views: 270

Answers (1)

Krzysztof Szularz
Krzysztof Szularz

Reputation: 5249

Use a proxy model for the job. Inherit by 3rd party model, overwrite objects and use this class instead of an original one.

Upvotes: 2

Related Questions