What I am trying to achieve is set a cache_page on a certain class-based view and when a user saves a certain model,, the cache in the page is supposed to be deleted. I tried using:
cache_page(60*1, key_prefix='artists')
then declaring this on the models.py
def save(self, *args, **kwargs):
from django.core.cache import cache
cache.delete('artists')
super(Artist, self).save(*args, **kwargs)
However it did not work.
I tried using:
cache.clear()
on the custom save method(the same line as cache.delete()) And it worked.. But what I want is just deleting a certain cache not everything that is why .clear() is not acceptable