However, the query cache is only useful in certain scenarios.
A fairly static database which is hit by the same SELECT queries often will benefit from the result set coming directly from the cache instead of hitting the tables.
If your database is frequently hit by INSERT and UPDATE queries, it’s going to be spending precious time checking the query cache and invalidating cached queries.
If your query cache is large, your SELECT queries may be noticeably slowed waiting on a response from the query cache while it’s busy removing invalidated queries by some other thread.
For our test cases, we are going to use the following domain model: The For Hibernate to cache a given query result, we need to explicitly set the cachable query attribute when creating the Query.
Scale Arc has introduced auto cache invalidation to the industry – a method for automatically invalidating cache entries that enables true ACID-compliant caching.
Standard Query Cache; timestamp=5872026465492992 Ehcache General Data Region - key: sql: select querycache0_as id1_1_, querycache0_.author_id as author_i4_1_, querycache0_.created_on as created_2_1_, querycache0_as name3_1_ from Post querycache0_ order by querycache0_.created_on desc; parameters: ; named parameters: ; max rows: 10; transformer: org.hibernate.transform.
See Limiting the size of the Query Cache below for details.
If the item descriptor is set to distributed hybrid caching, any action on the local repository is propagated to other ATG instances, whether invoked by the boolean or non-boolean method version.
The Query Cache is strictly related to Entities, and it draws an association between a search criterion and the Entities fulfilling that specific query filter.
With this invalidation method, Scale Arc can guarantee that its cache will not serve stale data.
This feature significantly increases the number of use cases where you can apply caching without the risk of data inconsistency challenges that can result from using TTL-based invalidation.