Replies: 2 comments 6 replies
-
It is not hard to implement, so I do not see objections to implement this featrue soon.
I have a little bit different architecture view about how does it should be implemented. The key point of each bucket4j integration - is utilizing as less third-party API as it possible. Following to this idea provides good surviving of the third-party API changes, usually Bucket4j does not need to be upgraded when third-part changed. So, I do not think that we should add new dependencies like RedisCodec from Lettuci and something similar from Jedis and Redisson. Instead it is enough to introduce new interface Mapper to the library and use Mapper directly inside LettuceBasedProxyManager(toBytes), JedisBasedProxyManager(toBytes) and RedissonBasedProxyManager(toString).
Providing pull request will allow to bring closer the feature release. Use 8.3 branch as the base(and target). |
Beta Was this translation helpful? Give feedback.
-
Released with version 8.3.0 |
Beta Was this translation helpful? Give feedback.
-
Hi @vladimir-bukhtoyarov
Saw #351 and thought that it would be nice to have a similar change done for Redis-backed Proxy Managers.
I use a LettuceBasedProxyManager but my keys are usually Strings, meaning I always have to use
String#getBytes(StandardCharsets.UTF_8)
to convert my Strings intobyte[]
before using as a key. This also means hotswapping ProxyManagers between different implementations for different configurations using Spring dependency injection isn't always so simple.Is this a feature on the radar for anytime soon?
For Lettuce at least, they provide RedisCodec to convert keys, so something like the following can be done to allow for applying custom RedisCodecs for key mappings (and ignoring the value mapper), without breaking existing code.
With this one would be able to use
builderFor(redisClient, StringCodec.UTF8)
to create aLettuceBasedProxyManager<String>
to allow for String keysHappy to look into raising a PR for this if you are open to the idea
Beta Was this translation helpful? Give feedback.
All reactions