Francisco Spaeth
Francisco Spaeth

Reputation: 23913

Hazelcast - Oldest Entries Evicted First

I'm using hazelcast to store data that are important for a small time window (maybe 30 to 50 min, but no more than 60 min). The older the entry, the less important it is, meaning if we could get rid of some entries to avoid an OutOfMemory would be the older entries.

I configured the TTL for those entries to 60 min but when running out of memory I would like to reliable get rid of oldest entries first even they are not expired.

I checked the configuration of EvictionPolicy.LRU but configuring it I could see that some recently added entries to the map are getting evicted. I suppose that is due to the sampling algorithm used to elect entries for eviction as explained here.

Is there any implementation of distributed objects that covers this use-case?

Upvotes: 3

Views: 523

Answers (1)

Vik Gamov
Vik Gamov

Reputation: 5456

Starting from Hazelcast 3.7, you will be able to define a custom eviction policy and implement any algorithm. You can find a sample here.

Thank you

Upvotes: 1

Related Questions