Madhuri Haritha
Madhuri Haritha

Reputation: 367

How to configure cache expiry to none and overflowToDisk="false" in ehcache 3.5 version?

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"

Upvotes: 4

Views: 5349

Answers (3)

Matej Janotka
Matej Janotka

Reputation: 332

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

Upvotes: 1

Manikandaprabu.G
Manikandaprabu.G

Reputation: 121

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

Upvotes: 2

Hetal Rachh
Hetal Rachh

Reputation: 1543

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 :)

Upvotes: 6

Related Questions