-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Redis Cache: support more complex types #43320
Conversation
Draft because there's one implementation TODO that I need to think about -- but the rest should be ready for review. I'm parsing types at runtime and not at build time, because transferring types through the recorder mechanism is not exactly possible. I could easily copy the ArC code that turns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parser is pretty neat!
2 things I just thought about: It should be possible to construct the Maybe the API shouldn't accept |
This includes generic types, like `List<String>`, array types, like `int[]`, and more. The type parser in this commit is reasonably complete. Omitting type variables should not be an issue; nested types might, but adding support for them should be doable later.
8408c14
to
bcc9bb7
Compare
I think this is ready now. I've implemented both ideas from above, so the type parser is now in To the methods on |
This comment has been minimized.
This comment has been minimized.
One more thing that perhaps needs @cescoffier's attention: I added a TODO to the implementation of |
Status for workflow
|
enforceDefaultType(); | ||
byte[] encodedKey = marshaller.encode(computeActualKey(encodeKey(key))); | ||
return withConnection(new Function<RedisConnection, Uni<V>>() { | ||
@Override | ||
public Uni<V> apply(RedisConnection redisConnection) { | ||
return (Uni<V>) doGet(redisConnection, encodedKey, classOfValue, marshaller); | ||
// TODO maybe use `type` (if non-null?) instead of `classOfValue`? | ||
return doGet(redisConnection, encodedKey, classOfValue, marshaller); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's a bug 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have another commit that makes the RedisCache
API overall more regular (all get*
methods have 3 variants: without type, using the default value type, with Class
type, and with TypeLiteral
type). I'll submit that in another PR so we can discuss properly, if you agree.
@cescoffier Could you please approve if this looks OK? Alternatively, could you please share who would be the best reviewer here? Both for the |
Sorry, missed the notification. Let's merge! Thanks! |
Thank you! |
This includes generic types, like
List<String>
, array types, likeint[]
, and more.The type parser in this commit is reasonably complete. Omitting type variables should not be an issue; nested types might, but adding support for them should be doable later.
Fixes #41301