0👍
A cron or Celery beat task (if you already use celery) looks like the best option.
Calling Article.objects.home()
would not do much unless you cache in home()
method of the manager (which could be a valid option that could simplify automated cache refresh).
To automate the refresh of view cache you better send actual requests to the URL from the management command. You will also want to invalidate the cache before sending the request, in order to update it.
Also, keep in mind the cache timeout when planning the job frequency. You wouldn’t want to refresh too early nor too late.
Source:stackexchange.com