Skip to content

Commit

Permalink
Add LPOS command
Browse files Browse the repository at this point in the history
  • Loading branch information
francois-ferrandis authored and PatrickTulskie committed Mar 7, 2024
1 parent 44447f2 commit f9259a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/redis/namespace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class Namespace
"linsert" => [ :first ],
"llen" => [ :first ],
"lpop" => [ :first ],
"lpos" => [ :first ],
"lpush" => [ :first ],
"lpushx" => [ :first ],
"lrange" => [ :first ],
Expand Down
6 changes: 6 additions & 0 deletions spec/redis_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@
expect(@redis.get('foo')).to eq('bar')
end

it 'should be able to use a namespace with lpos' do
@namespaced.rpush('foo', %w[a b c 1 2 3 c c])
expect(@namespaced.lpos('foo', 'c')).to eq(2)
expect(@redis.lpos('mykey', 'c')).to be_nil
end

it 'should be able to use a namespace with brpoplpush' do
@namespaced.lpush('foo','bar')
expect(@namespaced.brpoplpush('foo','bar',0)).to eq('bar')
Expand Down

0 comments on commit f9259a6

Please sign in to comment.