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
The above describes a simple PHP using Redis cache method, including the content, I hope the PHP tutorial interested in a friend helpful.