[] Hibernate second level cache and query cache

A, Hibernate secondary cache

1.1 features like cache

  • The bulk of the cache object data.

Hibernate view of a secondary bulk data cache
Hibernate view of a secondary bulk data cache

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
FIG set of two secondary cache buffers Hibernate

1.3 secondary cache data to disk

Update timestamp area

Figure III Hibernate update timestamp area
Figure III Hibernate update timestamp area

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>
    

Guess you like

Origin www.cnblogs.com/haoworld/p/bhibernate-er-ji-huan-cun-ji-cha-xun-huan-cun.html