How to create a disk persistent cache without configuring the memory required for it in ehcache 3.8 ?

131 views
Skip to first unread message

Aparna Eswaran

unread,
Mar 11, 2020, 7:40:57 AM3/11/20
to ehcache-users
How to create a disk persistent cache without configuring the memory required for it in ehcache 3.8 ?

Earlier in ehcache 2.9, we enjoyed the disk persistence facility of a cache without specifying the memory required for it using the only flag (diskPersistent="true"). It was helpful for the cases where we couldn't estimate the memory required for a cache.

How to achieve the same facility in ehcache 3.8 ?

When I tried the following configuration in ehcache 3.8 xml,

<resources>
    <heap unit="entries">10</heap>
    <disk unit="GB" persistent="true">0</disk>
</resources>

compilation error is shown with the message (Value '0' is not facet-valid with respect to minInclusive '1' for type 'positiveInteger') if the memory is not configured (i.e., when the value is 0 or -1).

Also, the following methods available for creating a disk tier in ResourcePoolsBuilder

* disk(long size, MemoryUnit unit)
* disk(long size, MemoryUnit unit, boolean persistent)

enforces size to be greater than 0.

Please help with the ways for configuring a disk persistent cache without configuring the memory required for it in ehcache 3.8

soccergods

unread,
Jul 23, 2020, 3:50:04 AM7/23/20
to ehcache-users
Honestly I wouldn't worry too much about this. If you don't really care about a limit, why not just put something arbitrarily high like 10GB or something. Or maybe even 64GB/100GB. But I don't think you really want the cache to fill up so much. I would say you should simply put your disk size as 1-2GB and if you see any limitations, change it to something higher. 
Reply all
Reply to author
Forward
0 new messages