Grokking Django
Vote

0% completed

​

Caching Whole Views and Sites in Django

One decorator line, @cache_page(30), makes Django keep the full response of a view for 30 seconds and send the stored copy to the next visitors without running the view. The previous lesson cached a single value with the cache object and one block of a template with the {% cache %} tag. Both still run the view on every request. Here the cache stores whole responses, first for one view and then for every page of the site.

The examples continue the same blog project: the Article model, the LocMemCache backend in CACHES, and the get_latest_articles() function in blog/services.py

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content