repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/transactions_test.rb | test/redis/transactions_test.rb | # frozen_string_literal: true
require "helper"
class TestTransactions < Minitest::Test
include Helper::Client
def test_multi_discard
assert_raises(LocalJumpError) do
r.multi
end
end
def test_multi_exec_with_a_block
r.multi do |multi|
multi.set "foo", "s1"
end
assert_equal "s... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/encoding_test.rb | test/redis/encoding_test.rb | # frozen_string_literal: true
require "helper"
class TestEncoding < Minitest::Test
include Helper::Client
def test_returns_properly_encoded_strings
r.set "foo", "שלום"
assert_equal "Shalom שלום", "Shalom #{r.get('foo')}"
refute_predicate "\xFF", :valid_encoding?
r.set("bar", "\xFF")
bytes =... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/pipelining_commands_test.rb | test/redis/pipelining_commands_test.rb | # frozen_string_literal: true
require "helper"
class TestPipeliningCommands < Minitest::Test
include Helper::Client
def test_bulk_commands
r.pipelined do |p|
p.lpush "foo", "s1"
p.lpush "foo", "s2"
end
assert_equal 2, r.llen("foo")
assert_equal "s2", r.lpop("foo")
assert_equal "s... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/unknown_commands_test.rb | test/redis/unknown_commands_test.rb | # frozen_string_literal: true
require "helper"
class TestUnknownCommands < Minitest::Test
include Helper::Client
def test_should_try_to_work
assert_raises Redis::CommandError do
r.not_yet_implemented_command
end
end
end
| ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/fork_safety_test.rb | test/redis/fork_safety_test.rb | # frozen_string_literal: true
require "helper"
class TestForkSafety < Minitest::Test
include Helper::Client
def setup
skip("Fork unavailable") unless Process.respond_to?(:fork)
end
def test_fork_safety
redis = Redis.new(OPTIONS)
pid = fork do
1000.times do
assert_equal "OK", redis.... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/ssl_test.rb | test/redis/ssl_test.rb | # frozen_string_literal: true
require "helper"
class SslTest < Minitest::Test
include Helper::Client
def test_connection_to_non_ssl_server
assert_raises(Redis::CannotConnectError) do
redis = Redis.new(OPTIONS.merge(ssl: true, timeout: LOW_TIMEOUT))
redis.ping
end
end
def test_verified_ss... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/bitpos_test.rb | test/redis/bitpos_test.rb | # frozen_string_literal: true
require "helper"
class TestBitpos < Minitest::Test
include Helper::Client
def test_bitpos_empty_zero
r.del "foo"
assert_equal(0, r.bitpos("foo", 0))
end
def test_bitpos_empty_one
r.del "foo"
assert_equal(-1, r.bitpos("foo", 1))
end
def test_bitpos_zero
... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/scanning_test.rb | test/redis/scanning_test.rb | # frozen_string_literal: true
require "helper"
class TestScanning < Minitest::Test
include Helper::Client
def test_scan_basic
r.debug :populate, 1000
cursor = 0
all_keys = []
loop do
cursor, keys = r.scan cursor
all_keys += keys
break if cursor == "0"
end
assert_equal ... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/commands_on_geo_test.rb | test/redis/commands_on_geo_test.rb | # frozen_string_literal: true
require "helper"
class TestCommandsGeo < Minitest::Test
include Helper::Client
def setup
super
added_items_count = r.geoadd("Sicily", 13.361389, 38.115556, "Palermo", 15.087269, 37.502669, "Catania")
assert_equal 2, added_items_count
end
def test_geoadd_with_array_... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/commands_on_sets_test.rb | test/redis/commands_on_sets_test.rb | # frozen_string_literal: true
require "helper"
class TestCommandsOnSets < Minitest::Test
include Helper::Client
include Lint::Sets
end
| ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/connection_handling_test.rb | test/redis/connection_handling_test.rb | # frozen_string_literal: true
require "helper"
require 'lint/authentication'
class TestConnectionHandling < Minitest::Test
include Helper::Client
include Lint::Authentication
def test_id
commands = {
client: ->(cmd, name) { @name = [cmd, name]; "+OK" },
ping: -> { "+PONG" }
}
redis_moc... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/url_param_test.rb | test/redis/url_param_test.rb | # frozen_string_literal: true
require "helper"
class TestUrlParam < Minitest::Test
include Helper::Client
def test_url_defaults_to_localhost
redis = Redis.new
assert_equal "localhost", redis._client.host
assert_equal 6379, redis._client.port
assert_equal 0, redis._client.db
assert_nil redis.... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/helper_test.rb | test/redis/helper_test.rb | # frozen_string_literal: true
require "helper"
class TestHelper < Minitest::Test
include Helper
def test_version_comparison
v = Version.new("2.0.1")
assert v > "1"
assert v > "2"
assert v < "3"
assert v < "10"
assert v < "2.1"
assert v < "2.0.2"
assert v < "2.0.1.1"
assert v... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/commands_on_strings_test.rb | test/redis/commands_on_strings_test.rb | # frozen_string_literal: true
require "helper"
class TestCommandsOnStrings < Minitest::Test
include Helper::Client
include Lint::Strings
end
| ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/commands_on_value_types_test.rb | test/redis/commands_on_value_types_test.rb | # frozen_string_literal: true
require "helper"
class TestCommandsOnValueTypes < Minitest::Test
include Helper::Client
include Lint::ValueTypes
def test_del
r.set "foo", "s1"
r.set "bar", "s2"
r.set "baz", "s3"
assert_equal ["bar", "baz", "foo"], r.keys("*").sort
assert_equal 0, r.del("")
... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/commands_on_lists_test.rb | test/redis/commands_on_lists_test.rb | # frozen_string_literal: true
require "helper"
class TestCommandsOnLists < Minitest::Test
include Helper::Client
include Lint::Lists
end
| ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/commands_on_streams_test.rb | test/redis/commands_on_streams_test.rb | # frozen_string_literal: true
require "helper"
# ruby -w -Itest test/commands_on_streams_test.rb
# @see https://redis.io/commands#stream
class TestCommandsOnStreams < Minitest::Test
include Helper::Client
include Lint::Streams
end
| ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/client_test.rb | test/redis/client_test.rb | # frozen_string_literal: true
require "helper"
class TestClient < Minitest::Test
include Helper::Client
def test_call
result = r.call("PING")
assert_equal result, "PONG"
end
def test_call_with_arguments
result = r.call("SET", "foo", "bar")
assert_equal result, "OK"
end
def test_with_blo... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/commands_on_hashes_test.rb | test/redis/commands_on_hashes_test.rb | # frozen_string_literal: true
require "helper"
class TestCommandsOnHashes < Minitest::Test
include Helper::Client
include Lint::Hashes
end
| ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/connection_test.rb | test/redis/connection_test.rb | # frozen_string_literal: true
require "helper"
class TestConnection < Minitest::Test
include Helper::Client
def test_provides_a_meaningful_inspect
assert_equal "#<Redis client v#{Redis::VERSION} for redis://localhost:#{PORT}/15>", r.inspect
end
def test_connection_with_user_and_password
target_versi... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/persistence_control_commands_test.rb | test/redis/persistence_control_commands_test.rb | # frozen_string_literal: true
require "helper"
class TestPersistenceControlCommands < Minitest::Test
include Helper::Client
def test_save
redis_mock(save: -> { "+SAVE" }) do |redis|
assert_equal "SAVE", redis.save
end
end
def test_bgsave
redis_mock(bgsave: -> { "+BGSAVE" }) do |redis|
... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/blocking_commands_test.rb | test/redis/blocking_commands_test.rb | # frozen_string_literal: true
require "helper"
class TestBlockingCommands < Minitest::Test
include Helper::Client
include Lint::BlockingCommands
def assert_takes_longer_than_client_timeout
timeout = LOW_TIMEOUT
delay = timeout * 5
mock(delay: delay) do |r|
t1 = Time.now
yield(r)
... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/commands_on_hyper_log_log_test.rb | test/redis/commands_on_hyper_log_log_test.rb | # frozen_string_literal: true
require "helper"
class TestCommandsOnHyperLogLog < Minitest::Test
include Helper::Client
include Lint::HyperLogLog
end
| ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/redis/publish_subscribe_test.rb | test/redis/publish_subscribe_test.rb | # frozen_string_literal: true
require "helper"
class TestPublishSubscribe < Minitest::Test
include Helper::Client
def setup
@threads = {}
super
end
def teardown
super
@threads.each do |thread, redis|
if redis.subscribed?
redis.unsubscribe
redis.punsubscribe
end
... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/distributed/remote_server_control_commands_test.rb | test/distributed/remote_server_control_commands_test.rb | # frozen_string_literal: true
require "helper"
class TestDistributedRemoteServerControlCommands < Minitest::Test
include Helper::Distributed
def test_info
keys = [
"redis_version",
"uptime_in_seconds",
"uptime_in_days",
"connected_clients",
"used_memory",
"total_connection... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/distributed/commands_on_sorted_sets_test.rb | test/distributed/commands_on_sorted_sets_test.rb | # frozen_string_literal: true
require "helper"
class TestDistributedCommandsOnSortedSets < Minitest::Test
include Helper::Distributed
include Lint::SortedSets
def test_zrangestore
assert_raises(Redis::Distributed::CannotDistribute) { super }
end
def test_zinter
assert_raises(Redis::Distributed::Ca... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/distributed/scripting_test.rb | test/distributed/scripting_test.rb | # frozen_string_literal: true
require "helper"
class TestDistributedScripting < Minitest::Test
include Helper::Distributed
def to_sha(script)
r.script(:load, script).first
end
def test_script_exists
a = to_sha("return 1")
b = a.succ
assert_equal [true], r.script(:exists, a)
assert_equal... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/distributed/sorting_test.rb | test/distributed/sorting_test.rb | # frozen_string_literal: true
require "helper"
class TestDistributedSorting < Minitest::Test
include Helper::Distributed
def test_sort
assert_raises(Redis::Distributed::CannotDistribute) do
r.set("foo:1", "s1")
r.set("foo:2", "s2")
r.rpush("bar", "1")
r.rpush("bar", "2")
r.sor... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/distributed/internals_test.rb | test/distributed/internals_test.rb | # frozen_string_literal: true
require "helper"
class TestDistributedInternals < Minitest::Test
include Helper::Distributed
def test_provides_a_meaningful_inspect
nodes = ["redis://127.0.0.1:#{PORT}/15", *NODES]
redis = Redis::Distributed.new nodes
assert_equal "#<Redis client v#{Redis::VERSION} for ... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/distributed/transactions_test.rb | test/distributed/transactions_test.rb | # frozen_string_literal: true
require "helper"
class TestDistributedTransactions < Minitest::Test
include Helper::Distributed
def test_multi_discard_without_watch
@foo = nil
assert_raises Redis::Distributed::CannotDistribute do
r.multi { @foo = 1 }
end
assert_nil @foo
assert_raises R... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/distributed/key_tags_test.rb | test/distributed/key_tags_test.rb | # frozen_string_literal: true
require "helper"
class TestDistributedKeyTags < Minitest::Test
include Helper
include Helper::Distributed
def test_hashes_consistently
r1 = Redis::Distributed.new ["redis://127.0.0.1:#{PORT}/15", *NODES]
r2 = Redis::Distributed.new ["redis://127.0.0.1:#{PORT}/15", *NODES]
... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/distributed/commands_on_sets_test.rb | test/distributed/commands_on_sets_test.rb | # frozen_string_literal: true
require "helper"
class TestDistributedCommandsOnSets < Minitest::Test
include Helper::Distributed
include Lint::Sets
def test_smove
assert_raises Redis::Distributed::CannotDistribute do
r.sadd 'foo', 's1'
r.sadd 'bar', 's2'
r.smove('foo', 'bar', 's1')
en... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/distributed/commands_requiring_clustering_test.rb | test/distributed/commands_requiring_clustering_test.rb | # frozen_string_literal: true
require "helper"
class TestDistributedCommandsRequiringClustering < Minitest::Test
include Helper::Distributed
def test_rename
r.set("{qux}foo", "s1")
r.rename "{qux}foo", "{qux}bar"
assert_equal "s1", r.get("{qux}bar")
assert_nil r.get("{qux}foo")
end
def test... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/distributed/connection_handling_test.rb | test/distributed/connection_handling_test.rb | # frozen_string_literal: true
require "helper"
class TestDistributedConnectionHandling < Minitest::Test
include Helper::Distributed
def test_ping
assert_equal ["PONG"], r.ping
end
def test_select
r.set "foo", "bar"
r.select 14
assert_nil r.get("foo")
r.select 15
assert_equal "bar"... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/distributed/commands_on_strings_test.rb | test/distributed/commands_on_strings_test.rb | # frozen_string_literal: true
require "helper"
class TestDistributedCommandsOnStrings < Minitest::Test
include Helper::Distributed
include Lint::Strings
def test_mget
r.set("foo", "s1")
r.set("bar", "s2")
assert_equal ["s1", "s2"], r.mget("foo", "bar")
assert_equal ["s1", "s2", nil], r.mget("f... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/distributed/commands_on_value_types_test.rb | test/distributed/commands_on_value_types_test.rb | # frozen_string_literal: true
require "helper"
class TestDistributedCommandsOnValueTypes < Minitest::Test
include Helper::Distributed
include Lint::ValueTypes
def test_del
r.set "foo", "s1"
r.set "bar", "s2"
r.set "baz", "s3"
assert_equal ["bar", "baz", "foo"], r.keys("*").sort
assert_equ... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/distributed/commands_on_lists_test.rb | test/distributed/commands_on_lists_test.rb | # frozen_string_literal: true
require "helper"
class TestDistributedCommandsOnLists < Minitest::Test
include Helper::Distributed
include Lint::Lists
def test_lmove
target_version "6.2" do
assert_raises Redis::Distributed::CannotDistribute do
r.lmove('foo', 'bar', 'LEFT', 'RIGHT')
end
... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/distributed/commands_on_hashes_test.rb | test/distributed/commands_on_hashes_test.rb | # frozen_string_literal: true
require "helper"
class TestDistributedCommandsOnHashes < Minitest::Test
include Helper::Distributed
include Lint::Hashes
def test_mapped_hmget_in_a_pipeline_returns_hash
assert_raises(Redis::Distributed::CannotDistribute) do
super
end
end
end
| ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/distributed/persistence_control_commands_test.rb | test/distributed/persistence_control_commands_test.rb | # frozen_string_literal: true
require "helper"
class TestDistributedPersistenceControlCommands < Minitest::Test
include Helper::Distributed
def test_save
redis_mock(save: -> { "+SAVE" }) do |redis|
assert_equal ["SAVE"], redis.save
end
end
def test_bgsave
redis_mock(bgsave: -> { "+BGSAVE" ... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/distributed/distributed_test.rb | test/distributed/distributed_test.rb | # frozen_string_literal: true
require "helper"
class TestDistributed < Minitest::Test
include Helper::Distributed
def test_handle_multiple_servers
@r = Redis::Distributed.new ["redis://127.0.0.1:#{PORT}/15", *NODES]
100.times do |idx|
@r.set(idx.to_s, "foo#{idx}")
end
100.times do |idx|
... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/distributed/blocking_commands_test.rb | test/distributed/blocking_commands_test.rb | # frozen_string_literal: true
require "helper"
class TestDistributedBlockingCommands < Minitest::Test
include Helper::Distributed
include Lint::BlockingCommands
def test_blmove_raises
target_version "6.2" do
assert_raises(Redis::Distributed::CannotDistribute) do
r.blmove('foo', 'bar', 'LEFT',... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/distributed/commands_on_hyper_log_log_test.rb | test/distributed/commands_on_hyper_log_log_test.rb | # frozen_string_literal: true
require "helper"
class TestDistributedCommandsOnHyperLogLog < Minitest::Test
include Helper::Distributed
include Lint::HyperLogLog
def test_pfmerge
assert_raises Redis::Distributed::CannotDistribute do
super
end
end
def test_pfcount_multiple_keys_diff_nodes
... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/test/distributed/publish_subscribe_test.rb | test/distributed/publish_subscribe_test.rb | # frozen_string_literal: true
require "helper"
class TestDistributedPublishSubscribe < Minitest::Test
include Helper::Distributed
def test_subscribe_and_unsubscribe
assert_raises Redis::Distributed::CannotDistribute do
r.subscribe("foo", "bar") {}
end
assert_raises Redis::Distributed::CannotDi... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/examples/pubsub.rb | examples/pubsub.rb | # frozen_string_literal: true
require "redis"
puts <<~EOS
To play with this example use redis-cli from another terminal, like this:
$ redis-cli publish one hello
Finally force the example to exit sending the 'exit' message with:
$ redis-cli publish two exit
EOS
redis = Redis.new
trap(:INT) { puts; e... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/examples/dist_redis.rb | examples/dist_redis.rb | # frozen_string_literal: true
require "redis"
require "redis/distributed"
r = Redis::Distributed.new %w[
redis://localhost:6379
redis://localhost:6380
redis://localhost:6381
redis://localhost:6382
]
r.flushdb
r['urmom'] = 'urmom'
r['urdad'] = 'urdad'
r['urmom1'] = 'urmom1'
r['urdad1'] = 'urdad1'
r['urmom2']... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/examples/incr-decr.rb | examples/incr-decr.rb | # frozen_string_literal: true
require 'redis'
r = Redis.new
puts
p 'incr'
r.del 'counter'
p r.incr('counter')
p r.incr('counter')
p r.incr('counter')
puts
p 'decr'
p r.decr('counter')
p r.decr('counter')
p r.decr('counter')
| ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/examples/sets.rb | examples/sets.rb | # frozen_string_literal: true
require 'rubygems'
require 'redis'
r = Redis.new
r.del 'foo-tags'
r.del 'bar-tags'
puts
p "create a set of tags on foo-tags"
r.sadd 'foo-tags', 'one'
r.sadd 'foo-tags', 'two'
r.sadd 'foo-tags', 'three'
puts
p "create a set of tags on bar-tags"
r.sadd 'bar-tags', 'three'
r.sadd 'bar-... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/examples/consistency.rb | examples/consistency.rb | # frozen_string_literal: true
# This file implements a simple consistency test for Redis-rb (or any other
# Redis environment if you pass a different client object) where a client
# writes to the database using INCR in order to increment keys, but actively
# remember the value the key should have. Before every write a... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/examples/basic.rb | examples/basic.rb | # frozen_string_literal: true
require 'redis'
r = Redis.new
r.del('foo')
puts
p 'set foo to "bar"'
r['foo'] = 'bar'
puts
p 'value of foo'
p r['foo']
| ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/examples/sentinel.rb | examples/sentinel.rb | # frozen_string_literal: true
require 'redis'
# This example creates a master-slave setup with a sentinel, then connects to
# it and sends write commands in a loop.
#
# After 30 seconds, the master dies. You will be able to see how a new master
# is elected and things continue to work as if nothing happened.
#
# To r... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/examples/list.rb | examples/list.rb | # frozen_string_literal: true
require 'rubygems'
require 'redis'
r = Redis.new
r.del 'logs'
puts
p "pushing log messages into a LIST"
r.rpush 'logs', 'some log message'
r.rpush 'logs', 'another log message'
r.rpush 'logs', 'yet another log message'
r.rpush 'logs', 'also another log message'
puts
p 'contents of lo... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/examples/unicorn/unicorn.rb | examples/unicorn/unicorn.rb | # frozen_string_literal: true
require "redis"
worker_processes 3
# If you set the connection to Redis *before* forking,
# you will cause forks to share a file descriptor.
#
# This causes a concurrency problem by which one fork
# can read or write to the socket while others are
# performing other operations.
#
# Most... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/test/commands_on_sorted_sets_test.rb | cluster/test/commands_on_sorted_sets_test.rb | # frozen_string_literal: true
require "helper"
# ruby -w -Itest test/cluster_commands_on_sorted_sets_test.rb
# @see https://redis.io/commands#sorted_set
class TestClusterCommandsOnSortedSets < Minitest::Test
include Helper::Cluster
include Lint::SortedSets
def test_zrangestore
assert_raises(Redis::CommandE... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/test/client_transactions_test.rb | cluster/test/client_transactions_test.rb | # frozen_string_literal: true
require "helper"
# ruby -w -Itest test/cluster_client_transactions_test.rb
class TestClusterClientTransactions < Minitest::Test
include Helper::Cluster
def test_cluster_client_does_support_transaction_by_single_key
actual = redis.multi do |tx|
tx.set('counter', '0')
... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/test/commands_on_transactions_test.rb | cluster/test/commands_on_transactions_test.rb | # frozen_string_literal: true
require "helper"
# ruby -w -Itest test/cluster_commands_on_transactions_test.rb
# @see https://redis.io/commands#transactions
class TestClusterCommandsOnTransactions < Minitest::Test
include Helper::Cluster
def test_discard
assert_raises(Redis::Cluster::AmbiguousNodeError) do
... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/test/client_internals_test.rb | cluster/test/client_internals_test.rb | # frozen_string_literal: true
require "helper"
# ruby -w -Itest test/cluster_client_internals_test.rb
class TestClusterClientInternals < Minitest::Test
include Helper::Cluster
def test_handle_multiple_servers
100.times { |i| redis.set(i.to_s, "hogehoge#{i}") }
100.times { |i| assert_equal "hogehoge#{i}",... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/test/commands_on_server_test.rb | cluster/test/commands_on_server_test.rb | # frozen_string_literal: true
require "helper"
# ruby -w -Itest test/cluster_commands_on_server_test.rb
# @see https://redis.io/commands#server
class TestClusterCommandsOnServer < Minitest::Test
include Helper::Cluster
def test_bgrewriteaof
assert_equal 'Background append only file rewriting started', redis.... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/test/commands_on_scripting_test.rb | cluster/test/commands_on_scripting_test.rb | # frozen_string_literal: true
require "helper"
# ruby -w -Itest test/cluster_commands_on_scripting_test.rb
# @see https://redis.io/commands#scripting
class TestClusterCommandsOnScripting < Minitest::Test
include Helper::Cluster
def test_eval
script = 'return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}'
argv = %w[f... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/test/commands_on_cluster_test.rb | cluster/test/commands_on_cluster_test.rb | # frozen_string_literal: true
require "helper"
# ruby -w -Itest test/cluster_commands_on_cluster_test.rb
# @see https://redis.io/commands#cluster
class TestClusterCommandsOnCluster < Minitest::Test
include Helper::Cluster
def test_cluster_addslots
assert_raises(Redis::Cluster::OrchestrationCommandNotSupporte... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/test/commands_on_geo_test.rb | cluster/test/commands_on_geo_test.rb | # frozen_string_literal: true
require "helper"
# ruby -w -Itest test/cluster_commands_on_geo_test.rb
# @see https://redis.io/commands#geo
class TestClusterCommandsOnGeo < Minitest::Test
include Helper::Cluster
def add_sicily
redis.geoadd('Sicily',
13.361389, 38.115556, 'Palermo',
... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/test/commands_on_sets_test.rb | cluster/test/commands_on_sets_test.rb | # frozen_string_literal: true
require "helper"
# ruby -w -Itest test/cluster_commands_on_sets_test.rb
# @see https://redis.io/commands#set
class TestClusterCommandsOnSets < Minitest::Test
include Helper::Cluster
include Lint::Sets
def test_sdiff
assert_raises(Redis::CommandError) { super }
end
def tes... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/test/commands_on_keys_test.rb | cluster/test/commands_on_keys_test.rb | # frozen_string_literal: true
require "helper"
# ruby -w -Itest test/cluster_commands_on_keys_test.rb
# @see https://redis.io/commands#generic
class TestClusterCommandsOnKeys < Minitest::Test
include Helper::Cluster
def set_some_keys
redis.set('key1', 'Hello')
redis.set('key2', 'World')
redis.set('{... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/test/client_pipelining_test.rb | cluster/test/client_pipelining_test.rb | # frozen_string_literal: true
require "helper"
# ruby -w -Itest test/cluster_client_pipelining_test.rb
class TestClusterClientPipelining < Minitest::Test
include Helper::Cluster
def test_pipelining_with_a_hash_tag
p1 = p2 = p3 = p4 = p5 = p6 = nil
redis.pipelined do |r|
r.set('{Presidents.of.USA}:... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/test/commands_on_strings_test.rb | cluster/test/commands_on_strings_test.rb | # frozen_string_literal: true
require "helper"
# ruby -w -Itest test/cluster_commands_on_strings_test.rb
# @see https://redis.io/commands#string
class TestClusterCommandsOnStrings < Minitest::Test
include Helper::Cluster
include Lint::Strings
def mock(*args, &block)
redis_cluster_mock(*args, &block)
end
... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/test/commands_on_value_types_test.rb | cluster/test/commands_on_value_types_test.rb | # frozen_string_literal: true
require "helper"
# ruby -w -Itest test/cluster_commands_on_value_types_test.rb
class TestClusterCommandsOnValueTypes < Minitest::Test
include Helper::Cluster
include Lint::ValueTypes
def test_move
assert_raises(Redis::CommandError) { super }
end
def test_copy
assert_r... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/test/commands_on_lists_test.rb | cluster/test/commands_on_lists_test.rb | # frozen_string_literal: true
require "helper"
# ruby -w -Itest test/cluster_commands_on_lists_test.rb
# @see https://redis.io/commands#list
class TestClusterCommandsOnLists < Minitest::Test
include Helper::Cluster
include Lint::Lists
def test_lmove
target_version "6.2" do
assert_raises(Redis::Comman... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/test/commands_on_streams_test.rb | cluster/test/commands_on_streams_test.rb | # frozen_string_literal: true
require "helper"
# ruby -w -Itest test/cluster_commands_on_streams_test.rb
# @see https://redis.io/commands#stream
class TestClusterCommandsOnStreams < Minitest::Test
include Helper::Cluster
include Lint::Streams
def test_xread_with_multiple_keys
err_msg = "CROSSSLOT Keys in r... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/test/commands_on_connection_test.rb | cluster/test/commands_on_connection_test.rb | # frozen_string_literal: true
require "helper"
require 'lint/authentication'
# ruby -w -Itest test/cluster_commands_on_connection_test.rb
# @see https://redis.io/commands#connection
class TestClusterCommandsOnConnection < Minitest::Test
include Helper::Cluster
include Lint::Authentication
def test_echo
ass... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/test/commands_on_hashes_test.rb | cluster/test/commands_on_hashes_test.rb | # frozen_string_literal: true
require "helper"
# ruby -w -Itest test/cluster_commands_on_hashes_test.rb
# @see https://redis.io/commands#hash
class TestClusterCommandsOnHashes < Minitest::Test
include Helper::Cluster
include Lint::Hashes
end
| ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/test/helper.rb | cluster/test/helper.rb | # frozen_string_literal: true
require_relative "../../test/helper"
$LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
require "redis-clustering"
require_relative 'support/orchestrator'
module Helper
module Cluster
include Generic
DEFAULT_HOST = '127.0.0.1'
DEFAULT_PORTS = (16_380..16_385).freeze
... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/test/blocking_commands_test.rb | cluster/test/blocking_commands_test.rb | # frozen_string_literal: true
require "helper"
# ruby -w -Itest test/cluster_blocking_commands_test.rb
class TestClusterBlockingCommands < Minitest::Test
include Helper::Cluster
include Lint::BlockingCommands
def mock(options = {}, &blk)
commands = build_mock_commands(options)
redis_cluster_mock(comman... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/test/client_replicas_test.rb | cluster/test/client_replicas_test.rb | # frozen_string_literal: true
require "helper"
# ruby -w -Itest test/cluster_client_replicas_test.rb
class TestClusterClientReplicas < Minitest::Test
include Helper::Cluster
def test_client_can_command_with_replica
r = build_another_client(replica: true)
100.times do |i|
assert_equal 'OK', r.set("... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/test/commands_on_pub_sub_test.rb | cluster/test/commands_on_pub_sub_test.rb | # frozen_string_literal: true
require "helper"
# ruby -w -Itest test/cluster_commands_on_pub_sub_test.rb
# @see https://redis.io/commands#pubsub
class TestClusterCommandsOnPubSub < Minitest::Test
include Helper::Cluster
def test_publish_subscribe_unsubscribe_pubsub
sub_cnt = 0
messages = {}
thread =... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/test/commands_on_hyper_log_log_test.rb | cluster/test/commands_on_hyper_log_log_test.rb | # frozen_string_literal: true
require "helper"
# ruby -w -Itest test/cluster_commands_on_hyper_log_log_test.rb
# @see https://redis.io/commands#hyperloglog
class TestClusterCommandsOnHyperLogLog < Minitest::Test
include Helper::Cluster
include Lint::HyperLogLog
def test_pfmerge
assert_raises Redis::Command... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/test/support/orchestrator.rb | cluster/test/support/orchestrator.rb | # frozen_string_literal: true
require 'redis'
class ClusterOrchestrator
SLOT_SIZE = 16_384
def initialize(node_addrs, timeout: 30.0)
raise 'Redis Cluster requires at least 3 master nodes.' if node_addrs.size < 3
@clients = node_addrs.map do |addr|
Redis.new(url: addr, timeout: timeout, reconnect_a... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/lib/redis-clustering.rb | cluster/lib/redis-clustering.rb | # frozen_string_literal: true
require "redis/cluster"
| ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/lib/redis/cluster.rb | cluster/lib/redis/cluster.rb | # frozen_string_literal: true
require "redis"
class Redis
class Cluster < ::Redis
# Raised when client connected to redis as cluster mode
# and failed to fetch cluster state information by commands.
class InitialSetupError < BaseError
end
# Raised when client connected to redis as cluster mode
... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/lib/redis/cluster/version.rb | cluster/lib/redis/cluster/version.rb | # frozen_string_literal: true
require "redis/version"
class Redis
class Cluster
VERSION = Redis::VERSION
end
end
| ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/lib/redis/cluster/client.rb | cluster/lib/redis/cluster/client.rb | # frozen_string_literal: true
require 'redis-cluster-client'
require 'redis/cluster/transaction_adapter'
class Redis
class Cluster
class Client < RedisClient::Cluster
ERROR_MAPPING = ::Redis::Client::ERROR_MAPPING.merge(
RedisClient::Cluster::InitialSetupError => Redis::Cluster::InitialSetupError,... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/cluster/lib/redis/cluster/transaction_adapter.rb | cluster/lib/redis/cluster/transaction_adapter.rb | # frozen_string_literal: true
require 'redis_client/cluster/transaction'
class Redis
class Cluster
class TransactionAdapter
class Internal < RedisClient::Cluster::Transaction
def initialize(client, router, command_builder, node: nil, slot: nil, asking: false)
@client = client
s... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/lib/redis.rb | lib/redis.rb | # frozen_string_literal: true
require "redis-client"
require "monitor"
require "redis/errors"
require "redis/commands"
class Redis
BASE_PATH = __dir__
Deprecated = Class.new(StandardError)
class << self
attr_accessor :silence_deprecations, :raise_deprecations
def deprecate!(message)
unless sile... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/lib/redis/pipeline.rb | lib/redis/pipeline.rb | # frozen_string_literal: true
require "delegate"
class Redis
class PipelinedConnection
attr_accessor :db
def initialize(pipeline, futures = [], exception: true)
@pipeline = pipeline
@futures = futures
@exception = exception
end
include Commands
def pipelined
yield self... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/lib/redis/version.rb | lib/redis/version.rb | # frozen_string_literal: true
class Redis
VERSION = '5.4.1'
end
| ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/lib/redis/errors.rb | lib/redis/errors.rb | # frozen_string_literal: true
class Redis
# Base error for all redis-rb errors.
class BaseError < StandardError
end
# Raised by the connection when a protocol error occurs.
class ProtocolError < BaseError
def initialize(reply_type)
super(<<-EOS.gsub(/(?:^|\n)\s*/, " "))
Got '#{reply_type}'... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/lib/redis/distributed.rb | lib/redis/distributed.rb | # frozen_string_literal: true
require "redis/hash_ring"
class Redis
class Distributed
class CannotDistribute < RuntimeError
def initialize(command)
@command = command
end
def message
"#{@command.to_s.upcase} cannot be used in Redis::Distributed because the keys involved need "... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/lib/redis/subscribe.rb | lib/redis/subscribe.rb | # frozen_string_literal: true
class Redis
class SubscribedClient
def initialize(client)
@client = client
@write_monitor = Monitor.new
end
def call_v(command)
@write_monitor.synchronize do
@client.call_v(command)
end
end
def subscribe(*channels, &block)
subs... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/lib/redis/commands.rb | lib/redis/commands.rb | # frozen_string_literal: true
require "redis/commands/bitmaps"
require "redis/commands/cluster"
require "redis/commands/connection"
require "redis/commands/geo"
require "redis/commands/hashes"
require "redis/commands/hyper_log_log"
require "redis/commands/keys"
require "redis/commands/lists"
require "redis/commands/pu... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/lib/redis/client.rb | lib/redis/client.rb | # frozen_string_literal: true
class Redis
class Client < ::RedisClient
ERROR_MAPPING = {
RedisClient::ConnectionError => Redis::ConnectionError,
RedisClient::CommandError => Redis::CommandError,
RedisClient::ReadTimeoutError => Redis::TimeoutError,
RedisClient::CannotConnectError => Redis... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/lib/redis/hash_ring.rb | lib/redis/hash_ring.rb | # frozen_string_literal: true
require 'zlib'
require 'digest/md5'
class Redis
class HashRing
POINTS_PER_SERVER = 160 # this is the default in libmemcached
attr_reader :ring, :sorted_keys, :replicas, :nodes
# nodes is a list of objects that have a proper to_s representation.
# replicas indicates ho... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/lib/redis/commands/pubsub.rb | lib/redis/commands/pubsub.rb | # frozen_string_literal: true
class Redis
module Commands
module Pubsub
# Post a message to a channel.
def publish(channel, message)
send_command([:publish, channel, message])
end
def subscribed?
!@subscription_client.nil?
end
# Listen for messages published ... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/lib/redis/commands/cluster.rb | lib/redis/commands/cluster.rb | # frozen_string_literal: true
class Redis
module Commands
module Cluster
# Sends `CLUSTER *` command to random node and returns its reply.
#
# @see https://redis.io/commands#cluster Reference of cluster command
#
# @param subcommand [String, Symbol] the subcommand of cluster command... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/lib/redis/commands/hyper_log_log.rb | lib/redis/commands/hyper_log_log.rb | # frozen_string_literal: true
class Redis
module Commands
module HyperLogLog
# Add one or more members to a HyperLogLog structure.
#
# @param [String] key
# @param [String, Array<String>] member one member, or array of members
# @return [Boolean] true if at least 1 HyperLogLog inter... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/lib/redis/commands/bitmaps.rb | lib/redis/commands/bitmaps.rb | # frozen_string_literal: true
class Redis
module Commands
module Bitmaps
# Sets or clears the bit at offset in the string value stored at key.
#
# @param [String] key
# @param [Integer] offset bit offset
# @param [Integer] value bit value `0` or `1`
# @return [Integer] the ori... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/lib/redis/commands/sets.rb | lib/redis/commands/sets.rb | # frozen_string_literal: true
class Redis
module Commands
module Sets
# Get the number of members in a set.
#
# @param [String] key
# @return [Integer]
def scard(key)
send_command([:scard, key])
end
# Add one or more members to a set.
#
# @param [Str... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/lib/redis/commands/hashes.rb | lib/redis/commands/hashes.rb | # frozen_string_literal: true
class Redis
module Commands
module Hashes
# Get the number of fields in a hash.
#
# @param [String] key
# @return [Integer] number of fields in the hash
def hlen(key)
send_command([:hlen, key])
end
# Set one or more hash values.
... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/lib/redis/commands/strings.rb | lib/redis/commands/strings.rb | # frozen_string_literal: true
class Redis
module Commands
module Strings
# Decrement the integer value of a key by one.
#
# @example
# redis.decr("value")
# # => 4
#
# @param [String] key
# @return [Integer] value after decrementing it
def decr(key)
... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/lib/redis/commands/keys.rb | lib/redis/commands/keys.rb | # frozen_string_literal: true
class Redis
module Commands
module Keys
# Scan the keyspace
#
# @example Retrieve the first batch of keys
# redis.scan(0)
# # => ["4", ["key:21", "key:47", "key:42"]]
# @example Retrieve a batch of keys matching a pattern
# redis.sca... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/lib/redis/commands/scripting.rb | lib/redis/commands/scripting.rb | # frozen_string_literal: true
class Redis
module Commands
module Scripting
# Control remote script registry.
#
# @example Load a script
# sha = redis.script(:load, "return 1")
# # => <sha of this script>
# @example Check if a script exists
# redis.script(:exists,... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/lib/redis/commands/streams.rb | lib/redis/commands/streams.rb | # frozen_string_literal: true
class Redis
module Commands
module Streams
# Returns the stream information each subcommand.
#
# @example stream
# redis.xinfo(:stream, 'mystream')
# @example groups
# redis.xinfo(:groups, 'mystream')
# @example consumers
# redis... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
redis/redis-rb | https://github.com/redis/redis-rb/blob/b6e81b2b3fb477cb8612d368d72a0bd179afbfe6/lib/redis/commands/connection.rb | lib/redis/commands/connection.rb | # frozen_string_literal: true
class Redis
module Commands
module Connection
# Authenticate to the server.
#
# @param [Array<String>] args includes both username and password
# or only password
# @return [String] `OK`
# @see https://redis.io/commands/auth AUTH command
d... | ruby | MIT | b6e81b2b3fb477cb8612d368d72a0bd179afbfe6 | 2026-01-04T15:47:51.017627Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.