Home > Backend Development > PHP Tutorial > Problem with Redis storing HTML after rendering the view

Problem with Redis storing HTML after rendering the view

WBOY
Release: 2023-03-01 19:44:01
Original
1180 people have browsed it

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.

Reply content:

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...

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template