標籤:style blog color io 使用 ar sp 資料 div
<ehcache> <!-- 指定一個目錄:當 EHCache 把資料寫到硬碟上時, 將把資料寫到這個目錄下. --> <diskStore path="d:\\tempDirectory"/> <!-- 設定緩衝的預設資料到期策略 --> <defaultCache maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="120" timeToLiveSeconds="120" overflowToDisk="true" /> <!-- 設定具體的具名快取的資料到期策略。每個具名快取代表一個快取區域 快取區域(region):一個具有名稱的緩衝塊,可以給每一個緩衝塊設定不同的緩衝策略。 如果沒有設定任何的快取區域,則所有被緩衝的對象,都將使用預設的緩衝策略。即:<defaultCache.../> Hibernate 在不同的快取區域儲存不同的類/集合。 對於類而言,地區的名稱是類名。如:com.atguigu.domain.Customer 對於集合而言,地區的名稱是類名加屬性名稱。如com.atguigu.domain.Customer.orders --> <!-- name: 設定緩衝的名字,它的取值為類的全限定名或類的集合的名字 maxElementsInMemory: 設定基於記憶體的緩衝中可存放的對象最大數目 eternal: 設定對象是否為永久的, true表示永不到期, 此時將忽略timeToIdleSeconds 和 timeToLiveSeconds屬性; 預設值是false timeToIdleSeconds:設定對象空閑最長時間,以秒為單位, 超過這個時間,對象到期。當對象到期時,EHCache會把它從緩衝中清除。如果此值為0,表示對象可以無限期地 處於空閑狀態。 timeToLiveSeconds:設定對象生存最長時間,超過這個時間,對象到期。如果此值為0,表示對象可以無限期地存在於緩衝中.
該屬性值必須大於或等於 timeToIdleSeconds 屬性值 overflowToDisk:設定基於記憶體的緩衝中的對象數目達到上限後,是否把溢出的對象寫到基於硬碟的緩衝中 --> <cache name="com.atguigu.hibernate.entities.Employee" maxElementsInMemory="1" eternal="false" timeToIdleSeconds="300" timeToLiveSeconds="600" overflowToDisk="true" /> <cache name="com.atguigu.hibernate.entities.Department.emps" maxElementsInMemory="1000" eternal="true" timeToIdleSeconds="0" timeToLiveSeconds="0" overflowToDisk="false" /></ehcache>
管理 Hibernate 的二級緩衝