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

Fix the Java example code for Lists using RPUSH #4074

Merged
merged 2 commits into from
Jan 31, 2025

Conversation

sanaulla123
Copy link
Contributor

In the example under Capped List on the documentation page: https://redis.io/docs/latest/develop/data-types/lists/
The Java-Sync library code example is not matching the one given in Redis CLI and also not matching the problem statement: "For example, if you're adding bikes on the end of a list of repairs, but only want to worry about the 3 that have been on the list the longest:"

The right solution is to use rpush and ltrim the first X elements.

This PR fixes the code to match the Redis CLI example.

@sazzad16 sazzad16 changed the title Fixing the Java code to match the redis cli example and the context Fix the Java example code for Lists using RPUSH Jan 31, 2025
@sazzad16
Copy link
Contributor

@sanaulla123 Thank you for noticing.

@andy-stark-redis No other examples match with redis-cli example.

If you confirm, we can merge this PR. If you want to fix differently, let us know.

Copy link
Contributor

@andy-stark-redis andy-stark-redis left a comment

Choose a reason for hiding this comment

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

Approved. I don't know why these were changed in the client examples, but I guess we should get them all in line with the CLI example.

@sazzad16 sazzad16 merged commit 0d4b0db into redis:master Jan 31, 2025
7 of 8 checks passed
@sazzad16
Copy link
Contributor

Merged. Thanks @sanaulla123 for contribution!

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

Successfully merging this pull request may close these issues.

4 participants