name:緩存名稱。緩存
maxElementsInMemory:緩存最大個數。hibernate
eternal:對象是否永久有效,一但設置了,timeout將不起做用。線程
timeToIdleSeconds:設置對象在失效前的容許閒置時間(單位:秒)。僅當eternal=false對象不是永久有效時使用,可選屬性,默認值是0,也就是可閒置時間無窮大。rest
timeToLiveSeconds:設置對象在失效前容許存活時間,最大時間介於建立時間和失效時間之間。僅當eternal=false對象不是永久有效時使用,默認是0.,也就是對象存活時 間無窮大。xml
overflowToDisk:當內存中對象數量達到maxElementsInMemory時,Ehcache將會對象寫到磁盤中。對象
diskSpoolBufferSizeMB:這個參數設置DiskStore(磁盤緩存)的緩存區大小。默認是30MB。每一個Cache都應該有本身的一個緩衝區。內存
maxElementsOnDisk:硬盤最大緩存個數。虛擬機
diskPersistent:是否緩存虛擬機重啓期數據 Whether the disk store persists between restarts of the Virtual Machine. The default value is false.io
diskExpiryThreadIntervalSeconds:磁盤失效線程運行時間間隔,默認是120秒。配置
memoryStoreEvictionPolicy:當達到maxElementsInMemory限制時,Ehcache將會根據指定的策略去清理內存。默認策略是LRU。你能夠設置爲 FIFO或是LFU。
clearOnFlush:內存數量最大時是否清除。
配置 name="org.hibernate.cache.StandardQueryCache" 和 name="org.hibernate.cache.UpdateTimestampsCache"
hibernate中引入<prop key="net.sf.ehcache.configurationResourceName">ehcache.xml</prop>