Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support HazelcastProxyManager.withExpirationStrategy #454

Closed
alturkovic opened this issue Mar 3, 2024 · 3 comments
Closed

Support HazelcastProxyManager.withExpirationStrategy #454

alturkovic opened this issue Mar 3, 2024 · 3 comments
Labels

Comments

@alturkovic
Copy link

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?

@vladimir-bukhtoyarov
Copy link
Collaborator

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.

@alturkovic
Copy link
Author

Thanks for the quick reply!

That sounds great. Thank you for maintaining such a useful library.

vladimir-bukhtoyarov pushed a commit that referenced this issue Mar 17, 2024
… going to be persisted, in order to add ability to calculated TTL
vladimir-bukhtoyarov pushed a commit that referenced this issue Mar 17, 2024
vladimir-bukhtoyarov pushed a commit that referenced this issue Mar 18, 2024
@vladimir-bukhtoyarov
Copy link
Collaborator

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants