4

In ehcache 2.x version I have following configuration.

<cache name="basicCache"
        maxEntriesLocalHeap="400"
        eternal="true"
        timeToIdleSeconds="0"
        timeToLiveSeconds="0"
        overflowToDisk="false">             
    </cache>

Following is the corresponding ehcache 3.x version.

<ehcache:cache alias="basicCache">
        <ehcache:key-type>java.lang.Long</ehcache:key-type>
    <ehcache:value-type>java.lang.String</ehcache:value-type>           
        <ehcache:resources>
            <ehcache:heap unit=entries">400</ehcache:heap>
        </ehcache:resources>    
    </ehcache:cache>

can someone help me to configure below attributes in ehcache 3.5.2 version.

eternal="true" and overflowToDisk="false"

Madhuri Haritha
  • 357
  • 1
  • 4
  • 13

3 Answers3

5

For setting eternal to true, which means the timeouts are ignored and cache will never expire. You can set this by setting expiry as none. Something like below,

<cache alias="backupCache">
    <key-type>java.lang.String</key-type>
    <value-type>java.lang.String</value-type>
    <expiry>
        <none/>
    </expiry>
    <resources>
        <heap unit="entries">100</heap>
    </resources>
</cache>

Hope this helps :)

Hetal Rachh
  • 1,393
  • 1
  • 17
  • 23
2

overflowToDisk concept has been removed from the ehcache 3.x version.Refer this link for more details

https://groups.google.com/forum/#!topic/ehcache-users/FFHHhRW5hdg

  • You say “overflowToDisk concept has been removed from the ehcache 3.x version”. It seems like that is the basis of the question. Instead of simply linking to an external resource could you please describe exactly how the question is answered and use the link as a reference? – C. Peck Mar 22 '19 at 07:39
1

And you don't have to configure overflowToDisk="false" because is disable by default as mentioned on link below

https://stackoverflow.com/a/27542783/12315712

Matej Janotka
  • 302
  • 3
  • 9