I have a site where the content of some pages had better to be cached in certain hours, to make faster the navigation back and forward inside the site itself, but those pages must be absolutely no cached on certain other hours, when crucial data updates are put in place. And to make things a little more complex, I need that some pages are never cached since their contents have continuous update.
Any solution to generally refresh pages or something like that has to be absolutely avoided.
But, to make it all a bit more complex once again, in case a specific page has been loaded a certain time before a certain hour, and data have been changed in the meantime (I can check the time or check the db, I suppose with js/jquery action to do it), then I would like to force refreshing that page.
Of course security best practices are needed in case of any js/jquery activity.
So in php and js/jquery how can I get the correct cache management for the needs explained above?
First, browser can auto cache static resources(css/js/img/...).
Second, I think the "cache" you said means you config the cache on your server.If so,I do not suggest you to config it, beacuse PHP needs to run dynamically,if you open the cache on your server,you may not get PHP rendered pages correctly.
I suggest that you can use CDN to speed up your static file, such as CSS-File,JS-File,some img. There're lots of free CDN for personal site.
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
About the technologies asked in this question
PHP (from the English Hypertext Preprocessor - hypertext preprocessor) is a scripting programming language for developing web applications. Supported by most hosting providers, it is one of the most popular tools for creating dynamic websites.
The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license. https://www.php.net/
CSS (Cascading Style Sheets) is a formal language for describing the appearance of a document written using a markup language.
It is mainly used as a means of describing, decorating the appearance of web pages written using HTML and XHTML markup languages, but can also be applied to any XML documents, such as SVG or XUL. https://www.w3.org/TR/CSS/#css
Welcome to programmierfrage.com
programmierfrage.com is a question and answer site for professional web developers, programming enthusiasts and website builders. Site created and operated by the community. Together with you, we create a free library of detailed answers to any question on programming, web development, website creation and website administration.
Get answers to specific questions
Ask about the real problem you are facing. Describe in detail what you are doing and what you want to achieve.
Help Others Solve Their Issues
Our goal is to create a strong community in which everyone will support each other. If you find a question and know the answer to it, help others with your knowledge.