ehcache的配置参数详解
<defaultCache
???????????? maxElementsInMemory="10000"
??????????? //缓存中最大允许创建的对象数
???????????? eternal="false"
??????????? //缓存中对象是否为永久的,如果是,超时设置将被忽略,对象从不过期
???????????? timeToIdleSeconds="120"
??????????? //缓存数据钝化时间(设置对象在它过期之前的空闲时间)
???????????? timeToLiveSeconds="120"
???????????? //缓存数据的生存时间(设置对象在它过期之前的生存时间)
???????????? overflowToDisk="true"
???????????? //内存不足时,是否启用磁盘缓存
? />
?
<diskStore>表示当内存缓存中对象数量超过类设置内存缓存数量时,将缓存对象写到硬盘,path=”java.io.tmpdir”表示把数据写到这个目录下。Java.io.tmpdir目录在运行时会根据相对路径生成。
<defaultCache>表示设定缓存的默认数据过期策略。
<cache>表示设定用具体的命名缓存的数据过期策略。
name表示具体的缓存命名。
maxElementsInMemory表示cache中最大允许保存的对象数据量。
eternal表示cache中数据是否为常量。
timeToIdleSeconds表示缓存数据钝化时间
timeToLiveSeconds表示缓存数据的生命时间。
?
?
??
?
??
?
??
?
overflowToDisk表示内存不足时,是否启用磁盘缓存。
?
?
<ehcache>
?<diskStore path="java.io.tmpdir" />
?<defaultCache maxElementsInMemory="1000" eternal="false" timeToIdleSeconds="120" timeToLiveSeconds="120"
??overflowToDisk="true" />
?<cache name="org.hibernate.cache.StandardQueryCache" maxElementsInMemory="1000" eternal="false"
??timeToIdleSeconds="120" timeToLiveSeconds="120" overflowToDisk="true" />
?<cache name="org.hibernate.cache.UpdateTimestampsCache" maxElementsInMemory="1000" eternal="false"
??timeToIdleSeconds="120" timeToLiveSeconds="120" overflowToDisk="true" />
?<!-- bean cache configuration -->
?<cache name="com.ou.entity.Biz" maxElementsInMemory="100" eternal="false" timeToIdleSeconds="3600"
??timeToLiveSeconds="7200" overflowToDisk="true" />?
?<cache name="com.ou.entity.BizConfig" maxElementsInMemory="100" eternal="false" timeToIdleSeconds="3600"
??timeToLiveSeconds="7200" overflowToDisk="true" />?
?<cache name="com.ou.entity.BizOrder" maxElementsInMemory="100" eternal="false" timeToIdleSeconds="3600"
??timeToLiveSeconds="7200" overflowToDisk="true" />?
?<cache name="com.ou.entity.BookItem" maxElementsInMemory="100" eternal="false" timeToIdleSeconds="3600"
??timeToLiveSeconds="7200" overflowToDisk="true" />?
?<cache name="com.ou.entity.Callboard" maxElementsInMemory="100" eternal="false" timeToIdleSeconds="3600"
??timeToLiveSeconds="7200" overflowToDisk="true" />?
?<cache name="com.ou.entity.CallMemo" maxElementsInMemory="100" eternal="false" timeToIdleSeconds="3600"
??timeToLiveSeconds="7200" overflowToDisk="true" />?
?<cache name="com.ou.entity.CardType" maxElementsInMemory="100" eternal="false" timeToIdleSeconds="3600"
??timeToLiveSeconds="7200" overflowToDisk="true" />?
?<cache name="com.ou.entity.Classroom" maxElementsInMemory="100" eternal="false" timeToIdleSeconds="3600"
??timeToLiveSeconds="7200" overflowToDisk="true" />?
?<cache name="com.ou.entity.Config" maxElementsInMemory="100" eternal="false" timeToIdleSeconds="3600"
??timeToLiveSeconds="7200" overflowToDisk="true" />?
?<cache name="com.ou.entity.Course" maxElementsInMemory="100" eternal="false" timeToIdleSeconds="3600"
??timeToLiveSeconds="7200" overflowToDisk="true" />?
?<cache name="com.ou.entity.CourseType" maxElementsInMemory="100" eternal="false" timeToIdleSeconds="3600"
??timeToLiveSeconds="7200" overflowToDisk="true" />?
?<cache name="com.ou.entity.EmailConfirm" maxElementsInMemory="100" eternal="false" timeToIdleSeconds="3600"
??timeToLiveSeconds="7200" overflowToDisk="true" />?
?<cache name="com.ou.entity.Image" maxElementsInMemory="100" eternal="false" timeToIdleSeconds="3600"
??timeToLiveSeconds="7200" overflowToDisk="true" />?
?<cache name="com.ou.entity.MemberLog" maxElementsInMemory="100" eternal="false" timeToIdleSeconds="3600"
??timeToLiveSeconds="7200" overflowToDisk="true" />?
?<cache name="com.ou.entity.MemberCount" maxElementsInMemory="100" eternal="false" timeToIdleSeconds="3600"
??timeToLiveSeconds="7200" overflowToDisk="true" />?
?<cache name="com.ou.entity.MemberOrder" maxElementsInMemory="100" eternal="false" timeToIdleSeconds="3600"
??timeToLiveSeconds="7200" overflowToDisk="true" />?
?<cache name="com.ou.entity.MembershipCard" maxElementsInMemory="100" eternal="false" timeToIdleSeconds="3600"
??timeToLiveSeconds="7200" overflowToDisk="true" />?
?<cache name="com.ou.entity.SystemProduct" maxElementsInMemory="100" eternal="false" timeToIdleSeconds="3600"
??timeToLiveSeconds="7200" overflowToDisk="true" />?
?<cache name="com.ou.entity.SystemProductType" maxElementsInMemory="100" eternal="false" timeToIdleSeconds="3600"
??timeToLiveSeconds="7200" overflowToDisk="true" />?
?<cache name="com.ou.entity.Task" maxElementsInMemory="100" eternal="false" timeToIdleSeconds="3600"
??timeToLiveSeconds="7200" overflowToDisk="true" />?
?<cache name="com.ou.entity.TaskType" maxElementsInMemory="100" eternal="false" timeToIdleSeconds="3600"
??timeToLiveSeconds="7200" overflowToDisk="true" />?
?<cache name="com.ou.entity.Template" maxElementsInMemory="100" eternal="false" timeToIdleSeconds="3600"
??timeToLiveSeconds="7200" overflowToDisk="true" />?
?<cache name="com.ou.entity.TemplateType" maxElementsInMemory="100" eternal="false" timeToIdleSeconds="3600"
??timeToLiveSeconds="7200" overflowToDisk="true" />?
?<cache name="com.ou.entity.User" maxElementsInMemory="100" eternal="false" timeToIdleSeconds="3600"
??timeToLiveSeconds="7200" overflowToDisk="true" />?
?<cache name="com.ou.entity.UserLog" maxElementsInMemory="100" eternal="false" timeToIdleSeconds="3600"
??timeToLiveSeconds="7200" overflowToDisk="true" />?
?<cache name="com.ou.entity.UserPart" maxElementsInMemory="100" eternal="false" timeToIdleSeconds="3600"
??timeToLiveSeconds="7200" overflowToDisk="true" />?
?
?<!-- application cache configuration -->
</ehcache>
?