Invalidating query cache entries dating for a month
It is not removed from the cache, but when next accessed it will be refreshed from the database as part of the query that was used to access it.
The application can also explicitly invalidate objects in the cache using the JPA API.
It sits between your application and the database to avoid the number of database hits as much as possible.
It allows you to provide your own cache implementation that might take advantage of specific cache driver.
If you want to support locking for The second level cache stores the entities, associations and collections.
The query cache has been disabled-by-default since My SQL 5.6 (2013) as it is known to not scale with high-throughput workloads on multi-core machines.
Rene confirmed this in his post yesterday, but it has also previously been mentioned by Stewart Smith, Domas Mituzas (update: and Kristian Koehntopp).
When turned on, entities will be first searched in cache and if they are not found, a database query will be fired and then the entity result will be stored in a cache provider.