Reputation: 10762
I would like to use Ehcache for the following task:
There's a routine that can be executed only n times a day. Each time it's invoked, a counter in the database is decreased. When it reaches 0, this fact is denoted in a shared hash map (filed under the current date), and there's no need to contact the database until the end of day. The database counter is reset to n at midnight by an asynchronous task, the hash map does not have appropriate entry for the new date, and database polling resumes.
Now I'd like to implement this behaviour in Ehcache, because we use it already for other caches, and because I'd like to be able to turn off all caching in one place. This poses the following problems:
@Cacheable
method (when it's discovered that the DB counter is zero). This probably rules out declarative cache specification, correct?Upvotes: 1
Views: 249
Reputation: 728
You will probably have to implements eviction policy if you want to do that with ehcache.
Upvotes: 2