MemoryStore and DiskStore Sizes

2010-09-23
2013-05-14
  • I have the following configuration for my ehcache.
    <CacheManager dynamicConfig="true" monitoring="autodetect" name="CacheManager1"
    updateCheck="true">
    <diskStore path="java.io.tmpdir" />
    <defaultCache clearOnFlush="true" copyOnRead="false" copyOnWrite="false"
    diskAccessStripes="1" diskExpiryThreadIntervalSeconds="5"
    diskPersistent="true" diskSpoolBufferSizeMB="20" eternal="true"
    logging="true" maxElementsInMemory="100" maxElementsOnDisk="100"
    memoryStoreEvictionPolicy="LRU" name="cache1" overflowToDisk="true"
    statistics="true" timeToIdleSeconds="0" timeToLiveSeconds="60"
    transactionalMode="off">
    </defaultCache>
    <cache clearOnFlush="true" copyOnRead="false" copyOnWrite="false"
    diskAccessStripes="1" diskExpiryThreadIntervalSeconds="5"
    diskPersistent="true" diskSpoolBufferSizeMB="20" eternal="true"
    logging="true" maxElementsInMemory="100" maxElementsOnDisk="100"
    memoryStoreEvictionPolicy="LRU" name="cache1" overflowToDisk="true"
    statistics="true" timeToIdleSeconds="0" timeToLiveSeconds="60"
    transactionalMode="off">
    </cache>
    </CacheManager>

    The maxElementsInMemoryStore and maxElementsOnDiskStore are set to 100. I have put 150 elements in the cache.

    When i query for the MemoryStoreSize and the DiskStoreSize i get 138 and 15. I could not understand the sizes returned. Can someone please explain why is it so??