spring cache of cache

  There is not envisaged such a scenario? Multiple users access the same url, the result is the same, and that a full visit very time consuming. Then we want to be a cache. What cache memory? Is saved url and the corresponding results? Or result in certain steps of this request? mybatis based on the results of a database query cache is well understood, but the spring in the cache is not well understood. We may be very familiar with, do cache function, will call the parameters used and the results hashMap saved. Dui, spring cache is cache parameters and results. And this should be a business-related issues and should be made into a section. Here we see spring in action to uncover the mystery of spring cache.

  Actually, this is a service from the cache of the boss, before I have seen spring cache, because I rarely used, and chapters on 15, did not look carefully, now that used the service, you have to learn, this practice makes sense that he dropped out to be meaningful. See from the directory, using just a two-step caching: 1 Configuration register (bean) 2 used where necessary (@Cacheable).. Use spring cache so simple, this is the spring style. geng

  So, in fact sping in the cache, the cache will not only allow you to write in memory, you can also write in redis, EhCache, the cache uses to provide great flexibility. And so on, there is one important thing is that you can use to SpEL condition of cached data. Well, the book's 374 is very classic, you can try to write their own code.

Guess you like

Origin www.cnblogs.com/Robin008/p/11443545.html