A shorthand php cache method using Redis

Source: Internet
Author: User
A simple PHP cache method using Redis

The caching method described here is relatively simple, the following is the approximate idea :

Example:
A list cache example, because the list data real-time requirements are not high, can be cached for 1 minutes.


Approximate idea:
According to the URL of the request to determine:
1. The requested URL hash is recorded in Redis and the data in Redis is returned directly.
2. After the requested URL hash is not recorded in Redis, the query database (MySQL) is saved to Redis and returned.
URL format: module, controller, Action (action), page


Data format for Redis cache:
are divided into two types:
One is the HTML tag, which is the HTML page that the frame renders.
The other is the JOSN data, which is part of the data required by the AJAX request.

@note

Using PHP for 5 months, this idea was thought out by my colleague (the leader) and recorded

20150809

1 floor static reading world
Isn't that how Redis is used?
  • 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.