Cache

A Cache is an information technology for the temporary storage (caching) of Web documents, such as Web pages, images, and other types of Web multimedia, to reduce server lag.

Caching is one of those methods which a website implements to become faster. It is cost efficient and saves CPU processing time.

Django comes with a robust cache system that lets you save dynamic pages so they don’t have to be calculated for each request.

You can cache the output of specific views, you can cache only the pieces that are difficult to produce, or you can cache your entire site.

Following are the options of caching:-

•Database Caching

•File System Caching

  • Local Memory Caching

How to implement Caching

Following are types of caching :

  • The per-site cache — Once the cache is set up, the simplest way to use caching is to cache your entire site.

•The per-view cache — A more granular way to use the caching framework is by caching the output of individual views.

  • Template fragment caching — This gives you more control what to cache. And only caches a particular part of HTML Template.
  • Low Level Caching — This gives you control to cache only a small data structure like list, dictionary etc. which can be pickled/serialised.

In this blog we would discuss caching an entire website(And thus consider it as part 1 of Caching Series).

#python #django #django-rest-framework #cache #django-framework

How to Cache Website using Django — Python ?
2.75 GEEK