django-orm-cache
django-orm-cache copied to clipboard
feature request: related model caching
I am using this technique in some of my models to cache related objects of GenericRelation(s), would this be a possible feature for django-orm-cache to implement?
Code
- https://gist.github.com/1260033
Example of this kind of caching:
comp = Computer.objects.get(pk=1)
comp.labels.all() # queries db and puts comp's labels in the cache
comp.labels.all() # returns objects from the cache instead of db
comp.labels.create(name="new label") # invalidates the cache for comp.labels
comp.labels.all() # queries db and puts comp's labels in the cache
comp.labels.get(pk=1).delete() # invalidates comp's label cache