I use django's built-in caching with the @cache_page
decorator. However, I would like the cache to be refreshed periodically automatically, so that a refresh is not triggered by an actual page request from a user resulting in a delay.
An obvious strategy that comes to mind is using a celery task. I have 2 questions please:
- If the celery task approach is acceptable, what code do I need to a) trigger the refresh and for b) an unknown number of pages e.g. myapp.com/products/?page=2, myapp.com/products/?page=3 (I cant predict the number of pages)
- Is there a better approach?