Issue
Is there a way of checking if an object is inside an EHCache managed cache?
The challenge I face is that I have implemented a method that retrieves a single value from the database (a find(key) method). The result of that find method is nicely cached by EHCache, but now I want to reduce the number of SQL queries that result from calling the method several times.
So to achieve this we implemented a new method which as argument takes a list of keys, but as the argument is different for every method call EHCache does a bad job on caching the results. EHCache used the method parameters as entry point to the cache.
So I would like to re-engineer some stuff. The idea was that I take the arguments in the find(list of keys) method, execute a large SQL query and then stuff the results inside the cache, I have not wrapped my head around it, but after writing this down it feels like manually modifying the cache is also a no go.
Any insight or hints are appreciated!
Solution
perhaps isKeyInCache?
Answered By - jtahlborn
Answer Checked By - Gilberto Lyons (JavaFixing Admin)