Python path--web--2--django-10-Cache

Source: Internet
Author: User

Seven, Cache

Since Django is a dynamic Web site, every request will go to the corresponding operation of the data, when the program access is large, time is bound to be more obvious, the simplest solution is to use: cache, the cache will be a certain views of the return value saved to memory or memcache, in 5 minutes when someone to visit , the operation in view is no longer performed, but is taken directly from memory or previously cached content in Redis and returned.

There are 6 kinds of caching methods available in Django:

    • Development and commissioning
    • Memory
    • File
    • Database
    • Memcache cache (python-memcached module)
    • Memcache cache (PYLIBMC module)
7.1. Configuration

A, development and commissioning

View Code

B, Memory

View Code

C. Documents

View Code

D. Database

View Code

E, Memcache cache (python-memcached module)

View Code

F, memcache cache (PYLIBMC module)

View Code

7.2. Application

A. Use all stations

View Code

B. Separate View cache

View Code

C, local view use

View Code

MORE: Bash here

Python path--web--2--django-10-Cache

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.