Adds per-view cache refreshing (clearing)
|Reported by:||k0001||Owned by:||nobody|
|Component:||Core (Cache system)||Version:||master|
|Severity:||Normal||Keywords:||cache refresh clear|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||yes||Patch needs improvement:||yes|
This patch adds the possibility to clear(refresh) cached data per view.
SmileyChris sugested it would be good to add another key to the cached keys where we could keep track of all the different cache_page_key hashes, so we that can delete those then.
It is possible to clear the cache for an specific view, to achieve that, you
should tell your view's url path (and optionally, a key_prefix) to
from django.utils.cache import clear_cache_for_path # clear the all cached data for path '/blog/posts/2/' clear_cache_for_path('/blog/posts/2/')
Note that it will delete every page cached from matching this path,
NOTE: Thanks SmileyChris for your help and supervision with this.
Change History (10)
comment:2 Changed 9 years ago by
|Patch needs improvement:||set|
|Triage Stage:||Design decision needed → Accepted|