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

#292 extend set method to accept a third positional argument #299

Merged
merged 2 commits into from Jan 17, 2024

Conversation

sho-work
Copy link
Contributor

@sho-work sho-work commented Jan 17, 2024

Summary

closes #292

This pull request is for issue #292.
I extend set method to accept a third positional argument.

Purpose of This Change

The primary goal of this change is to enhance the compatibility of the mock_redis set method with the redis-store set method. By introducing a third positional argument, we aim to align more closely with the redis-store implementation, facilitating easier integration and use in environments where redis-store is prevalent.

Compatibility Concerns with Standard Redis

While the redis-store set method accepts three positional arguments, the standard Redis set method traditionally takes only two. This discrepancy could raise concerns about compatibility. However, this change ensures that compatibility with the standard Redis API is maintained and verified through existing tests in set_spec.rb.

Before and After the Change

Before

The set method in mock_redis was defined as follows:

def set(key, value, ex: nil, px: nil, exat: nil, pxat: nil, nx: nil, xx: nil, keepttl: nil, get: nil)

This definition aligns with the standard Redis API but lacks compatibility with the redis-store version.

After

The revised set method is now defined with an additional third positional argument:

def set(key, value, _hash = nil, ex: nil, px: nil, exat: nil, pxat: nil, nx: nil, xx: nil, keepttl: nil, get: nil)

This addition enables compatibility with redis-store without compromising the existing functionality with standard Redis.

@sds sds merged commit 9518740 into sds:main Jan 17, 2024
11 checks passed
@sds
Copy link
Owner

sds commented Jan 17, 2024

Thank you!

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.

ArgumentError: wrong number of arguments (given 3, expected 2) When used in conjunction with redis-store
2 participants