redis-rb
redis-rb copied to clipboard
OBJECT command arguments arity
The object command in its current form requires a subcommand and a key. Would there be any objections to a PR to update the function definition from
def object(*args)
to
def object(subcommand, key)
(with the appropriate changes to the function too of course!)
See:
https://github.com/redis/redis-rb/blob/master/lib/redis.rb#L549
Any variant from 2 arguments and redis returns an error.
See
https://github.com/antirez/redis/blob/unstable/src/object.c#L1014
Given all subcommands require c->argc == 3 ('OBJECT' + 2 arguments)
Downside would be the possibility for 'new' subcommands with optional/multiple arguments to be added and this requiring a further update. A safer middle ground might be something like:
def object(subcommand, *args)
synchronize do |client|
client.call([:object, subcommand] + args)
end
end