From 4fdc02d9375b20087fbcbb34ad8a9182b0b1e5de Mon Sep 17 00:00:00 2001 From: Chandler Date: Tue, 22 Jul 2025 22:54:05 +0000 Subject: [PATCH] implemented hscan, hscan_each, and hstrlen on Redis::Distributed --- lib/redis/distributed.rb | 15 +++++++++++++++ test/distributed/commands_on_hashes_test.rb | 8 -------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/redis/distributed.rb b/lib/redis/distributed.rb index eef03803b..91bfd47ad 100644 --- a/lib/redis/distributed.rb +++ b/lib/redis/distributed.rb @@ -918,6 +918,21 @@ def hgetall(key) node_for(key).hgetall(key) end + # Scan a hash + def hscan(key, cursor, **options) + node_for(key).hscan(key, cursor, **options) + end + + # Scan a hash and return an enumerator + def hscan_each(key, **options, &block) + node_for(key).hscan_each(key, **options, &block) + end + + # Get the length of the value stored in a hash field + def hstrlen(key, field) + node_for(key).hstrlen(key, field) + end + # Post a message to a channel. def publish(channel, message) node_for(channel).publish(channel, message) diff --git a/test/distributed/commands_on_hashes_test.rb b/test/distributed/commands_on_hashes_test.rb index 31cd174f2..c8bb026f0 100644 --- a/test/distributed/commands_on_hashes_test.rb +++ b/test/distributed/commands_on_hashes_test.rb @@ -6,14 +6,6 @@ class TestDistributedCommandsOnHashes < Minitest::Test include Helper::Distributed include Lint::Hashes - def test_hscan - # Not implemented yet - end - - def test_hstrlen - # Not implemented yet - end - def test_mapped_hmget_in_a_pipeline_returns_hash assert_raises(Redis::Distributed::CannotDistribute) do super