Skip to content

Add LREM command support for removing list elements by value #38

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nishanthp
Copy link

@nishanthp nishanthp commented Jul 30, 2025

This PR implements the LREM (List Remove) functionality in list.py, enabling removal of list elements by value with count-based control.

Changes:

  • Added lrem function to support Redis LREM command
  • Allows removing elements equal to a specified value from Redis lists
  • Supports count parameter for controlling removal behavior:
    • count > 0: Remove elements from head to tail
    • count < 0: Remove elements from tail to head
    • count = 0: Remove all matching elements

Usage:

# Remove first 2 occurrences of "value" from head
lrem("mylist", 2, "value")

# Remove first occurrence of "value" from tail
lrem("mylist", -1, "value")

# Remove all occurrences of "value"
lrem("mylist", 0, "value")

@nishanthp nishanthp changed the title Add lrem functionality to list.py Add LREM command support for removing list elements by value Jul 30, 2025
@nishanthp
Copy link
Author

I was not sure how to add reviewers, so tagging you to review the PR mortensi. Thank you!

@mortensi
Copy link
Member

mortensi commented Aug 1, 2025

Thanks @nishanthp, we are looking at restructuring the toolset, and eventually reduce the number of exposed tools. As soon as we move forward, we'll review the PR and work on it. Thanks for contributing, I will keep you posted!

@nishanthp
Copy link
Author

Thanks @mortensi for the update! Looking forward to collaborating with you as things progress.

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.

2 participants