I have an opinion on static website cache. Let's discuss it.

Source: Internet
Author: User
I have an idea about static website caching. I have never learned about caching or anything. I always feel a little bloated. I hope that some simple and clear statements can be used to implement what I want. I am still a beginner in PHP, so you can discuss it. I want to design it like this. there is a table in the database & nbsp; web_page & nbsp; simple Field ID & nbsp; web_Url & nbsp has an idea of static website cache. Let's discuss it.
I have never learned about caching or anything. I always feel a little bloated.

I hope that some simple and clear statements can be used to implement what I want.

I am still a beginner in PHP, so you can discuss it.

I want to design it like this. the web_page field in the database is simple.
ID Web_Url Web_Key Web_UpDate

Users can access a page of the website at will and obtain the URL to the database for judgment,
If the page does not exist, generate a KEY and time for the page and passing parameters to be written to the database.
Generate a file named Web_Key to/temp /.

If you access this page again next time, determine whether the time is greater than the set 30 minutes,
If the value is smaller than, the web_key file is called directly. if the value is greater than, the file is generated again and updated at the same time.

In this way, the entire site can be cached in/temp/, and the validity period is set to 30 minutes or longer, because if no one accesses the site, it will not be updated.

Let's talk about this idea? This is my entry-level idea. Let's talk about it... Haha ..
------ Solution ----------------------
The implementation you introduced can also be

An implementation method is introduced here: the md5 value of the page address url is used as the first two characters of the file name as the file name, and then determined by file_exists.


------ Solution ----------------------
Unfortunately, your thinking is exactly what the bloated Cache mechanism uses.
But people do not need:
Obtain the URL to the database and determine whether the URL does not exist. if the URL does not exist, generate a KEY and time for the page and pass parameters to the database.

Instead, replace the characters that cannot appear in the file name from the url to get the cached file name.
Check whether the file exists. if the file does not exist or the file modification time is earlier than the agreed time, the cache file will be re-generated.

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.