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, Vary headers
NOTE: Thanks SmileyChris for your help and supervision with this.
Change History (10)
Changed 6 years ago by k0001
comment:1 Changed 6 years ago by Simon G.
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Design decision needed
comment:2 Changed 6 years ago by jacob
- Needs tests set
- Patch needs improvement set
- Triage Stage changed from Design decision needed to Accepted
comment:8 Changed 13 months ago by aaugustin
- Triage Stage changed from Accepted to Design decision needed