[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
请教一个问题!严重!!  XML
Forum Index -> Terracotta 中文社区
Author Message
wangjin

neo

Joined: 01/31/2013 01:21:38
Messages: 4
Offline

向大家请教一个问题,我使用2.5.7和2.6.3的时候发现一个问题,当我缓存的元素没有达到maxElementsInMemory参数所配置的数量时,ehcache仍会缓存到磁盘,也就是说,缓存到内存的同时,也会缓存到磁盘一份。可是查看网上的资料,不是应该达到maxElementsInMemory的数量以后,才会缓存至磁盘的吗?还是说我配置的有问题?我配置如下:
<cache name="shiro-activeSession"
maxElementsInMemory="5"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="true"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
/>
wangjin

neo

Joined: 01/31/2013 01:21:38
Messages: 4
Offline

补充一下,overflowToDisk="false"时,就不会出现上面所描述的问题,overflowToDisk="true" 就会出现。难道说overflowToDisk="true" 时,ehcache有这样的机制,及时没有到达maxElementsInMemory配置的数量,也会把缓存到内存的元素也同时缓存至磁盘一份?
rajoshi

seraphim

Joined: 07/04/2011 04:36:10
Messages: 1491
Offline

Can you please post in English.

Rakesh Joshi
Senior Consultant
Terracotta.
wangjin

neo

Joined: 01/31/2013 01:21:38
Messages: 4
Offline

When I use Ehcache(version 2.5.7 and 2.6.3),the amount of elements is not reach parameter of [maxElementsInMemory] , Ehcache also put each of element to disk .That is to say,Ehcache put element in memory, alse put the same of element on disk.
But i found information from document, only when the amount of elements reach [maxElementsInMemory],Ehcache will put element on disk,isn't it? Maybe my ehcache.xml has some error?
My ehcache.xml below:

<cache name="shiro-activeSession"
maxElementsInMemory="5"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="true"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
/>

PS:my english is poor! I wish you understand!Thanks for your reply!
sghose

journeyman

Joined: 06/26/2012 11:11:30
Messages: 46
Offline

Hello wangjin

Please use the following cache configuration:

<cache name="shiro-activeSession"
maxBytesLocalHeap ="some size"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="true"
diskPersistent="false"
/>

Please replace "some size" in the above xml to a number that you expect to cache ex. 10M or 1G etc. Please read about sizing ehcache here: http://ehcache.org/documentation/configuration/cache-size

Sourabh Ghose - Terracotta Solution Architect
[WWW]
 
Forum Index -> Terracotta 中文社区
Go to:   
Powered by JForum 2.1.7 © JForum Team