I'm using Ehcache 3.8.0 with my Spring 5.x application for caching long running data aggregation. The aggregated data is displayed in a web frontend.
I'm now looking for a way to get the age of an cached element to display it alongside with the data.
Ehcache 2.x stored cache entries as Element
(see javadoc) which had the public method getLatestOfCreationAndUpdateTime() to retrieve the timestamp, at which the cache entry was created or last updated (= the age/freshness of the cached data).
But in Ehcache 3.x cache entries are stored as Cache.Entry<V,K>
(see javadoc) which is nothing more than a key/value tuple which doesn't provide something like the getLatestOfCreationAndUpdateTime()
method.
I know that I could use something like cache eventlisteners to store the timestamp seperatly whenever a cache entry is created or updated, but I like to know if there's a more direct way to get the timestamp formerly provided with getLatestOfCreationAndUpdateTime()
.