Home > Article > Backend Development > Problem with Redis storing HTML after rendering the view
In the framework, after rendering the view, cache all the view content into Redis.
When the visiting address or conditions are consistent during the next visit, the cached content in Redis will be read directly.
What type of storage is more appropriate to use in Redis.
I am currently using String and tried hashing, but there is a drawback, that is, the expiration time cannot be set for each k-v,
And I need to set a separate validity time for each cached content
I would like to ask if you have any better suggestions or a solution that can achieve better performance and content scheduling in Redis! ?
Thank you.
In the framework, after rendering the view, cache all the view content into Redis.
When the visiting address or conditions are consistent during the next visit, the cached content in Redis will be read directly.
What type of storage is more appropriate to use in Redis.
I am currently using String and tried hashing, but there is a drawback, that is, the expiration time cannot be set for each k-v,
And I need to set a separate validity time for each cached content
I would like to ask if you have any better suggestions or a solution that can achieve better performance and content scheduling in Redis! ?
Thank you.
Use string, no problem.
Considering performance, remember to enable connection reuse. If your bandwidth is not enough, you can use compression such as zlib or lzo. If you want a better compression rate, you can pre-calculate a more targeted dictionary (Python's own zlib library supports this operation, and for PHP, write your own extension...).
Would it be faster to directly generate the corresponding static files...