A, Hibernate secondary cache
1.1 features like cache
- The bulk of the cache object data.
![Hibernate view of a secondary bulk data cache](media/15298220225850/%E5%9B%BE%E4%B8%80%20Hibernate%E7%9A%84%E4%BA%8C%E7%BA%A7%E7%BC%93%E5%AD%98%E7%9A%84%E6%95%A3%E8%A3%85%E6%95%B0%E6%8D%AE.jpg)
1.2 features a collection of buffer zone:
- Is cached object id. Buffer need to rely on configuration class.
![FIG set of two secondary cache buffers Hibernate](media/15298220225850/%E5%9B%BE%E4%BA%8C%20Hibernate%E4%BA%8C%E7%BA%A7%E7%BC%93%E5%AD%98%E7%9A%84%E9%9B%86%E5%90%88%E7%BC%93%E5%86%B2%E5%8C%BA.jpg)
1.3 secondary cache data to disk
Update timestamp area
![Figure III Hibernate update timestamp area](media/15298220225850/%E5%9B%BE%E4%B8%89%20Hibernate%E7%9A%84%E6%9B%B4%E6%96%B0%E6%97%B6%E9%97%B4%E6%88%B3%E5%8C%BA.jpg)
Second, the three-level cache query cache :( ??)
- More powerful than the secondary cache, and the query cache must rely on second-level cache.
- Secondary cache: cache class / object.
The query cache: cache for class attributes.
Query cache configuration:
- Configure the query cache:
- Provided that the secondary cache has been configured.
- In the core configuration file:
<!-- 配置查询缓存 --> <property name="hibernate.cache.use_query_cache">true</property>