Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EHCache refresh

Tags:

java

ehcache

In EHCache, is there a way to implement some kind of a db listener where the cahce will auto update if the data is out of sync? (e.g as soon as the user requests for data, the cahce checks if the data is out of sync, if yes...updates itself and returns the data, if not...just return the data from the cache)If someone can point me which part of the specification highlights this use, that would be awesome!

The goal is to always provide the latest data to the user. So I am guessing a timed refresh mechanism will not do as the data can change anytime.

EHCAche is not mandatory to use in my case, so any mechanism that satisfies this will be most welcome...

Thanks!!

like image 535
Victor Avatar asked Oct 19 '10 18:10

Victor


People also ask

Is Ehcache persistent?

Open-source Ehcache offers a limited version of persistence, as noted in this document. Fast Restart provides enterprise-ready crash resilience with an option to store a fully consistent copy of the cache on the local disk at all times.

Is Ehcache good?

EhCache is a widely used, pure Java cache that can be easily integrated with most popular Java frameworks, such as Spring and Hibernate. It is often considered to be the most convenient choice for Java applications since it can be integrated into projects easily.

Is Ehcache in memory cache?

In this article, we will introduce Ehcache, a widely used, open-source Java-based cache. It features memory and disk stores, listeners, cache loaders, RESTful and SOAP APIs and other very useful features.


1 Answers

For EhCache this is what I believe you are looking for. If you would not like to do timed refresh (even though it is a simple solution), triggers or a message bus based update would be the way to go. You can perform some statistics and see update frequency once the triggering has been established and switch to a timed update with sufficient frequency to satisfy Nyquist.

like image 188
whatnick Avatar answered Oct 20 '22 00:10

whatnick