0

Firstly I am totally new to Guava cache and Spring as well, I had searched more 50 sites but could not get, what I was looking for. I am searching for implementation of guava cache for caching database values using spring.

Also, previously I had implemented Ehcache but had the following issues:

  1. It does not work with static (as per my findings).
  2. @Cacheable is not working when the cacheable method is called via non-bean class instancehere's the similar issue.
  3. It requires a every time configuration of new cache (ehcache.xml). etc were problems.

So now I am looking for a solution which can over come above hurdles via guava cache if any one could provide a configuration + implementation example with spring than it be a ton help to me. Also if any other way is their for caching data from DB than please let me know (other than manual cache implementation like list,hashmap etc).

Community
  • 1
  • 1
Bhargav Modi
  • 2,605
  • 3
  • 29
  • 49
  • Please put together a minimal example, with the given amount of information it's going to be really hard to help you. Do you have a properly working Spring Application context? – reto Jan 30 '15 at 07:16
  • Have you gone trough the manual http://docs.spring.io/spring/docs/current/spring-framework-reference/html/cache.html ? – reto Jan 30 '15 at 07:18
  • @reto yes, I have proper working spring-application -context.xml with `hikari-cp` and currently with `ehcache` m using `namedjdbcparameterstemplate` – Bhargav Modi Jan 30 '15 at 07:19
  • Does the answer that is given to the question that you linked make sense? Do you understand the proxies in Spring? – reto Jan 30 '15 at 07:20
  • @reto yes I had gone through it roughly but later came know above mentioned bullet issues – Bhargav Modi Jan 30 '15 at 07:20
  • @reto yes that's why I had mentioned but it does has a solution rather it has criticism in that answer and one more thing it does not works with thread one more [similar issue](http://stackoverflow.com/q/28228865/2749470) I neeed to implement thread as well in my application – Bhargav Modi Jan 30 '15 at 07:24
  • I answered another question with a full example of how to setup Guava caching in spring here: http://stackoverflow.com/questions/8181768/can-i-set-a-ttl-for-cacheable/31926759#31926759 – anataliocs Aug 10 '15 at 18:54

0 Answers0