ehcache.xml 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <ehcache name="ColorCache">
  3. <!--
  4. 缓存在磁盘上的存储位置
  5. -->
  6. <diskStore path = "java.io.tmpdir" />
  7. <!--
  8. 缓存配置。
  9. 以下属性是必须的:
  10. name - cache的标识符,在一个CacheManager中必须唯一
  11. maxElementsInMemory - 在内存中缓存的element的最大数目
  12. maxElementsOnDisk - 在磁盘上缓存的element的最大数目
  13. eternal - 设定缓存的elements是否有有效期。如果为true,timeouts属性被忽略
  14. overflowToDisk - 设定当内存缓存溢出的时候是否将过期的element缓存到磁盘上
  15. 以下属性是可选的:
  16. timeToIdleSeconds - 缓存element在过期前的空闲时间。默认为0,表示可空闲无限时间.
  17. timeToLiveSeconds - 缓存element的有效生命期。这个类似于timeouts,默认为0,不过期
  18. diskPersistent - 在VM重启的时候是否持久化磁盘缓存,默认是false。
  19. diskExpiryThreadIntervalSeconds - 磁盘缓存的清理线程运行间隔,默认是120秒.
  20. memoryStoreEvictionPolicy - 当内存缓存达到最大,有新的element加入的时候,移除缓存中element的策略。默认是LRU,可选的有LFU和FIFO
  21. -->
  22. <defaultCache
  23. maxElementsInMemory="100000"
  24. eternal="false"
  25. timeToIdleSeconds="120"
  26. timeToLiveSeconds="120"
  27. diskSpoolBufferSizeMB="30"
  28. maxElementsOnDisk="10000000"
  29. diskExpiryThreadIntervalSeconds="120">
  30. </defaultCache>
  31. </ehcache>