Support HazelcastProxyManager.withExpirationStrategy
AbstractRedisProxyManagerBuilder has a very convenient withExpirationStrategy builder method to expire keys from Redis when they are not needed.
As far as I can see, there is no such support for Hazelcast. I do not have any prior experience with Hazelcast, so I am doing something like:
init {
hazelcast.config.addMapConfig(MapConfig(rateLimitKey)
.setMaxIdleSeconds(1.days.inWholeSeconds.toInt())
)
val registry: IMap<UUID, ByteArray> = hazelcast.getMap(rateLimitKey)
manager = HazelcastProxyManager(registry)
}
Would it be possible to add such method or am I missing something obvious?
Hello @alturkovic
Yes, it is possoble to add flexible TTL for hazelcast, that will be fully identical with Redis. It is enough to cast java.util.Map.Entry to com.hazelcast.map.ExtendedMapEntry inside HazelcastEntryProcessor and copy-past the loggic that used for Redis.
It looks I will be able to release this ffeature in two weeks. I am going to unify flexible expiration feature across all bucket4j's extensions, because it is obviously that Coherence, Ignite and Infinispan should provide comparabler functionality and it is not good to add feature just for Hazelcast.
Thanks for the quick reply!
That sounds great. Thank you for maintaining such a useful library.
@alturkovic
Feature has been released with version 8.10.1
Documentation available there https://bucket4j.com/8.10.1/toc.html#configuring-flexible-per-entry-expiration