Answer the question
In order to leave comments, you need to log in
How to implement a cache flush mechanism?
Situation. One of our old projects started loading mysql server. It has 40 thousand products, and attendance is 12 thousand per day. The main load was the filter of goods in the catalog. The cost of goods is formed on the basis of 8 pricing models, which have their own set of dependencies. I perevairiv indexes, added missing, removed unnecessary. The site began to work several times faster. PDO driver. Additionally, I decided to cache mysql queries and results. The caching mechanism works like this:
Before querying the database, a check is made to see if the file exists in the cache folder. If so, the contents of the file are pulled. File structure: file name - md5 from sql query, file content - serialized array of two parameters. The first is the cache expiration time (expired), the second is the content of the result of the sql query (result). Caching works great. But. How can I implement a mechanism for automatically clearing the cache when editing a product or category in the places where they are used. The system is modular. One and the same item may be present in search results, quick search, category browsing, etc. Now it's just in the admin panel a button to clear the cache, which deletes all the cache. The cache is written for 12 hours. Perhaps you have any thoughts on how it can be improved. Thanks
Answer the question
In order to leave comments, you need to log in
file name - md5 from sql query, file content - serialized array of two parameters
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question