Java – how does ehcache check whether there is something in the cache?

Is there any way to check whether the object is in the ehcache managed cache?

My challenge is that I have implemented a method to retrieve a single value from the database (a find (key) method) Ehcache caches the results of the find method well, but now I want to reduce the number of SQL queries generated by multiple calls to the method

Therefore, we implement a new method because the parameters need a key list, but ehcache is not good at caching results because the parameters of each method call are different Ehcache uses method parameters as the entry point for the cache

So I want to redesign something My idea is that I get the parameters in the search (key list) method, execute a large SQL query, and then fill the results into the cache. I didn't wrap the head, but after writing it down, it feels like it's impossible to modify the cache manually

Any comments or tips are appreciated!

Solution

Maybe iskeyincache?

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>