In database application development, there is no need for a large pile of code-type data to handle, such as country, document category, gender, occupation, etc., generally the primary development is where the code is required, and it will be taken in real time. Resulting in a lot of database query operations, it is a relatively large impact.
We think, since it is the data of the code class, it is generally not often. If you take these data one-time query, save it in memory, and you can save a lot of resources every time, is it possible to save a lot of resources? This is what usually said "cache), now there are many mature cache implementations (there are many open sources), but those specialized cache implementations, in order to consider versatility, often design is more complicated, if there is some little In the project, I always feel too complicated. Why do I don't write a relatively simple cache function? Based on this idea, I have implemented a simple cache function in my project, which can be used for web applications or Application. I have been successfully used in two ways, and the effect is not bad.
Today, I can't get it. If I have time tomorrow, I will write down the implementation process and sleep first. Zzzzzzzzzz