Skip to content

Commit 9fa1b3e

Browse files
authored
Merge pull request #1319 from underwoo16/underwoo16/distributed-hash-methods
Implement hscan, hscan_each, and hstrlen for Redis::Distributed
2 parents 1d96f77 + 4fdc02d commit 9fa1b3e

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

lib/redis/distributed.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,21 @@ def hgetall(key)
918918
node_for(key).hgetall(key)
919919
end
920920

921+
# Scan a hash
922+
def hscan(key, cursor, **options)
923+
node_for(key).hscan(key, cursor, **options)
924+
end
925+
926+
# Scan a hash and return an enumerator
927+
def hscan_each(key, **options, &block)
928+
node_for(key).hscan_each(key, **options, &block)
929+
end
930+
931+
# Get the length of the value stored in a hash field
932+
def hstrlen(key, field)
933+
node_for(key).hstrlen(key, field)
934+
end
935+
921936
# Post a message to a channel.
922937
def publish(channel, message)
923938
node_for(channel).publish(channel, message)

test/distributed/commands_on_hashes_test.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@ class TestDistributedCommandsOnHashes < Minitest::Test
66
include Helper::Distributed
77
include Lint::Hashes
88

9-
def test_hscan
10-
# Not implemented yet
11-
end
12-
13-
def test_hstrlen
14-
# Not implemented yet
15-
end
16-
179
def test_mapped_hmget_in_a_pipeline_returns_hash
1810
assert_raises(Redis::Distributed::CannotDistribute) do
1911
super

0 commit comments

Comments
 (0)