Usually, when an entry in an Ehcache cache exceeds its ttl/tti, it will be marked as stale. Then, when the cache is asked to return this stale entry, the entry will be deleted and the cache will return null. The calling method will have to go out to the datastore to get a fresh entry to store in the cache.
In my use case, if the datastore goes down it would be better to return stale data than to return no data. The problem is, by the time I make the datastore call to check whether it's up, my stale entry has already been deleted.
Is there any way to instruct Ehcache to purposefully return stale data under certain boolean circumstances (i.e. DatastoreMonitor returns isDown)?