First
-level cache (must exist)
the session has a shared cache that accompanies the session's life cycle existence and extinction:
1. The LOAD query entity supports first-level caching
2. The GET query entity object also supports
3. The entity object saved by Save is cached in the first level cache
4. Clear evict clears session cache
5. Save huge data, every 20 data, General flush execute the SQL to persist the data and then clear cache, prevent memory overflow, save put last.
6. Iterate using a first-level cache (Query entity objects in Creatquery list uses a first-level cache, query object entity properties are not used)
Level Two cache
process-level caches or sessionfactory caches can be shared by the session, accompanied by sessionfactory existence and extinction.
Query Cache
Cache only the normal attribute result set, the entity object caches only the ID
Life cycle: Ends when the table associated with the query changes. Not related to level two cache. Need to display enabled, Query.setcacheable (true) and only work on list, iterator does not work, it does not use query caching.
Crawl strategy
1. Query crawl fetch=join. The foreign key associated with the object is also taken out, a SQL, will invalidate the lazy, improve efficiency, can be configured or native SQL
2. Subselect Sub-query policy