Answer the question
In order to leave comments, you need to log in
What is the best way to organize a data caching system?
Good day to all. Question for PHP developers. What is the best way to organize data caching for fast work with them? My code sends a request to an external server and receives a response in the form of JSON, but I do not need to constantly send requests. Is it possible to implement response data caching better than writing the results to a file and reading them from that file?
Answer the question
In order to leave comments, you need to log in
First I'll answer the question you asked
. The best caching system is no caching.
And now for the one you wanted to ask
Is it possible to implement response data caching better than writing the results to a file and reading them from that file?Maybe. But not necessary.
A much bigger problem is not caching, but cache invalidation. How do you understand when the cache is rotten and you need to request a new one. For some data, this is obvious (such as the exchange rate. Although there are subtleties here), but for some it is not.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question