Skip to content

Conversation

@aszyrej
Copy link
Collaborator

@aszyrej aszyrej commented Dec 15, 2025

First e2e-test for Redis.
Includes GET and SET commands, applying Redis heuristics.

.filter(command -> command.getType().shouldCalculateHeuristic())
.forEach(redisCommand -> {
RedisDistanceWithMetrics distanceWithMetrics = computeDistance(redisCommand, redisClient);
RedisDistanceWithMetrics distanceWithMetrics = computeDistance(redisCommand, (RedisClient) redisClient);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi. thx @aszyrej i think it is best if @jgaleotti gives first round of comments, and then, after updating, i ll give my pass. but one thing here that caught my eyes is: why turning RedisClient into Object reference if anyway you do a cast to (RedisClient) here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @arcuri82 . The reason why I'm using Object is just to be aligned with the solutions for Mongo and OpenSearch where they used Object for the clients. It's not necessary to keep it this way and since I have a dedicated class for encapsulating the client logic, I could refactor it and keep that class instead of Object.
I'll proceed with this if you agree.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the reason for using private Object mongoClient is that cannot have dependencies to actual Mongo code, and must do access via reflection. if for Redis you encapsulate all the code for reflection in your own RedisClient that is different from io.lettuce.core.RedisClient, then no point in storing it as an Object reference. Btw, for clarity, your own RedisClient could be renamed into ReflectionBasedRedisClient (or something like that)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @arcuri82, I've renamed that class into ReflectionBasedRedisClient as we discussed, and changed the type in RedisHandler.

@aszyrej aszyrej requested a review from arcuri82 December 23, 2025 23:02
@arcuri82
Copy link
Collaborator

hi @jgaleotti it would be best if you look at this PR first, and then, after you approve it, i review it as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants