flâneur

Caching in Django | TestDriven.io

testdriven.io · 2,903 words · saved by 1 readers

This article first provides an overview of Django's caching framework and then shows how to cache a Django view using both Memcached and Redis.

Caching is typically the most effective way to boost an application's performance. For dynamic websites, when rendering a template, you'll often have to gather data from various sources (like a database, the file system, and third-party APIs, to name a few), process the data, and apply business logic to it before serving it up to a client. Any delay due to network latency will be noticed by the end user. For instance, say you have to make an HTTP call to an external API to grab the data required to render a template. Even in perfect conditions this will increase the rendering time which…

related reading