Hibernate cache: Session cache is transaction level cache, session closed, cache is automatically destroyed, developer does not manage, hibernate management, save, update, Saveoorupdate, lock, load, The list automatically stores the data in the first-level cache, and Get,load,list automatically takes the data from the primary cache, invoking evict (object object) and clear () to clean up the cache.
Hibernate level Two cache: the Sessionfactory cache is a process-level cache, implemented by a cache plug-in, such as Oscache, that provides support for Hibernate query caching, which is managed by the developer through configuration management such as whether to enable level two cache, specify which level of two cache to use, Specifies which domain enables level two, as well as the cache policy, the physical media that holds the data can be memory or hard disk, infrequently modified data, unimportant data, data that is not concurrently accessed, and data that is shared with other applications fit into the level two cache.
Hibernate first-level cache and level two cache