Trivial question.
The database of the online store stores absolutely everything - pages, menu items, names of controllers, products, categories, links, etc. Due to the fact that the database will be updated infrequently, the creation of a query caching module is an actual task. Looked through "Google", read the forums. I decided to do something similar to memesh:
- Static tables (menus, controllers) are undoubtedly immediately serialized and written to a file.
- All requests from the user (for example, product search by filters) are cached - namely, the result of the SELECT (array) is serialized and written to the file with the hashed label of the request itself. If such a label already exists, then the database query does not occur, and the data is extracted from the file, deserialized into an array, and issued to the browser.
- When an administrator changes a table, the cache file most likely is completely destroyed, and the browser, not finding the cache file, receives data from the database and “gives the command” to the server to create an updated cache file based on them.
How reasonable is this solution? I will consider all the comments and advice.