Search code examples
hibernateehcache

What is the need of UpdateTimestampsCache in EhCache configuration file?


I am not able to understand the exact use of UpdateTimestampsCache in ehCache ? I googled a lot but haven't anything except below statement.

Tracks the time stamps of the most recent updates to particular tables.

But whats the role of UpdateTimestampsCache in second level cache ?


Solution

  • UpdateTimestampsCache is only enabled when the query cache is enabled as it is explicitly part of invalidating the cached query results. When reading the cached query results, UpdateTimestampsCache checks the timestamp cached with the query results against the timestamps of all the tables it uses to determine if the results are still valid. So if UpdateTimestampsCache founds that the timestamp of the table is newer than cached one then it will invalidates the caches queries.