{"id":13463045,"url":"https://github.com/redis/redis-rb","last_synced_at":"2025-09-09T20:20:49.172Z","repository":{"id":510144,"uuid":"137805","full_name":"redis/redis-rb","owner":"redis","description":"A Ruby client library for Redis","archived":false,"fork":false,"pushed_at":"2025-08-11T23:33:53.000Z","size":2647,"stargazers_count":3986,"open_issues_count":22,"forks_count":1034,"subscribers_count":87,"default_branch":"master","last_synced_at":"2025-08-28T19:14:47.175Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/redis.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2009-02-26T00:53:51.000Z","updated_at":"2025-08-22T13:57:14.000Z","dependencies_parsed_at":"2023-07-06T16:16:25.745Z","dependency_job_id":"a9d0338c-47f7-415a-b483-a276c0482ea9","html_url":"https://github.com/redis/redis-rb","commit_stats":{"total_commits":1740,"total_committers":246,"mean_commits":7.073170731707317,"dds":0.7672413793103449,"last_synced_commit":"08f3e18db95ab4f3980d35a22f16904b53bb505d"},"previous_names":[],"tags_count":93,"template":false,"template_full_name":null,"purl":"pkg:github/redis/redis-rb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis%2Fredis-rb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis%2Fredis-rb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis%2Fredis-rb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis%2Fredis-rb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redis","download_url":"https://codeload.github.com/redis/redis-rb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis%2Fredis-rb/sbom","scorecard":{"id":641290,"data":{"date":"2025-08-11","repo":{"name":"github.com/redis/redis-rb","commit":"ec7e1ef7a721285a8a37357563a8f62760091e0f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.8,"checks":[{"name":"Maintained","score":10,"reason":"13 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":5,"reason":"Found 9/18 approved changesets -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/test.yaml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:121: update your workflow using https://app.stepsecurity.io/secureworkflow/redis/redis-rb/test.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yaml:129: update your workflow using https://app.stepsecurity.io/secureworkflow/redis/redis-rb/test.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:134: update your workflow using https://app.stepsecurity.io/secureworkflow/redis/redis-rb/test.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:158: update your workflow using https://app.stepsecurity.io/secureworkflow/redis/redis-rb/test.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yaml:166: update your workflow using https://app.stepsecurity.io/secureworkflow/redis/redis-rb/test.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:171: update your workflow using https://app.stepsecurity.io/secureworkflow/redis/redis-rb/test.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:191: update your workflow using https://app.stepsecurity.io/secureworkflow/redis/redis-rb/test.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yaml:199: update your workflow using https://app.stepsecurity.io/secureworkflow/redis/redis-rb/test.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:204: update your workflow using https://app.stepsecurity.io/secureworkflow/redis/redis-rb/test.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:230: update your workflow using https://app.stepsecurity.io/secureworkflow/redis/redis-rb/test.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yaml:238: update your workflow using https://app.stepsecurity.io/secureworkflow/redis/redis-rb/test.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:243: update your workflow using https://app.stepsecurity.io/secureworkflow/redis/redis-rb/test.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/redis/redis-rb/test.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yaml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/redis/redis-rb/test.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:43: update your workflow using https://app.stepsecurity.io/secureworkflow/redis/redis-rb/test.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yaml:51: update your workflow using https://app.stepsecurity.io/secureworkflow/redis/redis-rb/test.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/redis/redis-rb/test.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:82: update your workflow using https://app.stepsecurity.io/secureworkflow/redis/redis-rb/test.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yaml:90: update your workflow using https://app.stepsecurity.io/secureworkflow/redis/redis-rb/test.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:95: update your workflow using https://app.stepsecurity.io/secureworkflow/redis/redis-rb/test.yaml/master?enable=pin","Info:   0 out of  13 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   7 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 23 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T10:50:42.899Z","repository_id":510144,"created_at":"2025-08-21T10:50:42.903Z","updated_at":"2025-08-21T10:50:42.903Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272587156,"owners_count":24960398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-28T02:00:10.768Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T13:00:44.847Z","updated_at":"2025-09-09T20:20:49.136Z","avatar_url":"https://github.com/redis.png","language":"Ruby","readme":"# redis-rb [![Build Status][gh-actions-image]][gh-actions-link] [![Inline docs][rdoc-master-image]][rdoc-master-link]\n\nA Ruby client that tries to match [Redis][redis-home]' API one-to-one, while still providing an idiomatic interface.\n\nSee [RubyDoc.info][rubydoc] for the API docs of the latest published gem.\n\n## Getting started\n\nInstall with:\n\n```\n$ gem install redis\n```\n\nYou can connect to Redis by instantiating the `Redis` class:\n\n```ruby\nrequire \"redis\"\n\nredis = Redis.new\n```\n\nThis assumes Redis was started with a default configuration, and is\nlistening on `localhost`, port 6379. If you need to connect to a remote\nserver or a different port, try:\n\n```ruby\nredis = Redis.new(host: \"10.0.1.1\", port: 6380, db: 15)\n```\n\nYou can also specify connection options as a [`redis://` URL][redis-url]:\n\n```ruby\nredis = Redis.new(url: \"redis://:p4ssw0rd@10.0.1.1:6380/15\")\n```\n\nThe client expects passwords with special characters to be URL-encoded (i.e.\n`CGI.escape(password)`).\n\nTo connect to Redis listening on a Unix socket, try:\n\n```ruby\nredis = Redis.new(path: \"/tmp/redis.sock\")\n```\n\nTo connect to a password protected Redis instance, use:\n\n```ruby\nredis = Redis.new(password: \"mysecret\")\n```\n\nTo connect a Redis instance using [ACL](https://redis.io/topics/acl), use:\n\n```ruby\nredis = Redis.new(username: 'myname', password: 'mysecret')\n```\n\nThe Redis class exports methods that are named identical to the commands\nthey execute. The arguments these methods accept are often identical to\nthe arguments specified on the [Redis website][redis-commands]. For\ninstance, the `SET` and `GET` commands can be called like this:\n\n```ruby\nredis.set(\"mykey\", \"hello world\")\n# =\u003e \"OK\"\n\nredis.get(\"mykey\")\n# =\u003e \"hello world\"\n```\n\nAll commands, their arguments, and return values are documented and\navailable on [RubyDoc.info][rubydoc].\n\n## Connection Pooling and Thread safety\n\nThe client does not provide connection pooling. Each `Redis` instance\nhas one and only one connection to the server, and use of this connection\nis protected by a mutex.\n\nAs such it is heavily recommended to use the [`connection_pool` gem](https://github.com/mperham/connection_pool), e.g.:\n\n```ruby\nmodule MyApp\n  def self.redis\n    @redis ||= ConnectionPool::Wrapper.new do\n      Redis.new(url: ENV[\"REDIS_URL\"])\n    end\n  end\nend\n\nMyApp.redis.incr(\"some-counter\")\n```\n\n## Sentinel support\n\nThe client is able to perform automatic failover by using [Redis\nSentinel](http://redis.io/topics/sentinel).  Make sure to run Redis 2.8+\nif you want to use this feature.\n\nTo connect using Sentinel, use:\n\n```ruby\nSENTINELS = [{ host: \"127.0.0.1\", port: 26380 },\n             { host: \"127.0.0.1\", port: 26381 }]\n\nredis = Redis.new(name: \"mymaster\", sentinels: SENTINELS, role: :master)\n```\n\n* The master name identifies a group of Redis instances composed of a master\nand one or more slaves (`mymaster` in the example).\n\n* It is possible to optionally provide a role. The allowed roles are `master`\nand `slave`. When the role is `slave`, the client will try to connect to a\nrandom slave of the specified master. If a role is not specified, the client\nwill connect to the master.\n\n* When using the Sentinel support you need to specify a list of sentinels to\nconnect to. The list does not need to enumerate all your Sentinel instances,\nbut a few so that if one is down the client will try the next one. The client\nis able to remember the last Sentinel that was able to reply correctly and will\nuse it for the next requests.\n\nTo [authenticate](https://redis.io/docs/management/sentinel/#configuring-sentinel-instances-with-authentication) Sentinel itself, you can specify the `sentinel_username` and `sentinel_password`. Exclude the `sentinel_username` option if you're using password-only authentication.\n\n```ruby\nSENTINELS = [{ host: '127.0.0.1', port: 26380},\n             { host: '127.0.0.1', port: 26381}]\n\nredis = Redis.new(name: 'mymaster', sentinels: SENTINELS, sentinel_username: 'appuser', sentinel_password: 'mysecret', role: :master)\n```\n\nIf you specify a username and/or password at the top level for your main Redis instance, Sentinel *will not* using thouse credentials\n\n```ruby\n# Use 'mysecret' to authenticate against the mymaster instance, but skip authentication for the sentinels:\nSENTINELS = [{ host: '127.0.0.1', port: 26380 },\n             { host: '127.0.0.1', port: 26381 }]\n\nredis = Redis.new(name: 'mymaster', sentinels: SENTINELS, role: :master, password: 'mysecret')\n```\n\nSo you have to provide Sentinel credential and Redis explicitly even they are the same\n\n```ruby\n# Use 'mysecret' to authenticate against the mymaster instance and sentinel\nSENTINELS = [{ host: '127.0.0.1', port: 26380 },\n             { host: '127.0.0.1', port: 26381 }]\n\nredis = Redis.new(name: 'mymaster', sentinels: SENTINELS, role: :master, password: 'mysecret', sentinel_password: 'mysecret')\n```\n\nAlso the `name`, `password`, `username` and `db` for Redis instance can be passed as an url:\n\n```ruby\nredis = Redis.new(url: \"redis://appuser:mysecret@mymaster/10\", sentinels: SENTINELS, role: :master)\n```\n\n## Cluster support\n\n[Clustering](https://redis.io/topics/cluster-spec). is supported via the [`redis-clustering` gem](cluster/).\n\n## Pipelining\n\nWhen multiple commands are executed sequentially, but are not dependent,\nthe calls can be *pipelined*. This means that the client doesn't wait\nfor reply of the first command before sending the next command. The\nadvantage is that multiple commands are sent at once, resulting in\nfaster overall execution.\n\nThe client can be instructed to pipeline commands by using the\n`#pipelined` method. After the block is executed, the client sends all\ncommands to Redis and gathers their replies. These replies are returned\nby the `#pipelined` method.\n\n```ruby\nredis.pipelined do |pipeline|\n  pipeline.set \"foo\", \"bar\"\n  pipeline.incr \"baz\"\nend\n# =\u003e [\"OK\", 1]\n```\n\nCommands must be called on the yielded objects. If you call methods\non the original client objects from inside a pipeline, they will be sent immediately:\n\n```ruby\nredis.pipelined do |pipeline|\n  pipeline.set \"foo\", \"bar\"\n  redis.incr \"baz\" # =\u003e 1\nend\n# =\u003e [\"OK\"]\n```\n\n### Exception management\n\nThe `exception` flag in the `#pipelined` is a feature that modifies the pipeline execution behavior. When set\nto `false`, it doesn't raise an exception when a command error occurs. Instead, it allows the pipeline to execute all\ncommands, and any failed command will be available in the returned array. (Defaults to `true`)\n\n```ruby\nresults = redis.pipelined(exception: false) do |pipeline|\n  pipeline.set('key1', 'value1')\n  pipeline.lpush('key1', 'something') # This will fail\n  pipeline.set('key2', 'value2')\nend\n# results =\u003e [\"OK\", #\u003cRedisClient::WrongTypeError: WRONGTYPE Operation against a key holding the wrong kind of value\u003e, \"OK\"]\n\nresults.each do |result|\n  if result.is_a?(Redis::CommandError)\n    # Do something with the failed result\n  end\nend\n```\n\n\n### Executing commands atomically\n\nYou can use `MULTI/EXEC` to run a number of commands in an atomic\nfashion. This is similar to executing a pipeline, but the commands are\npreceded by a call to `MULTI`, and followed by a call to `EXEC`. Like\nthe regular pipeline, the replies to the commands are returned by the\n`#multi` method.\n\n```ruby\nredis.multi do |transaction|\n  transaction.set \"foo\", \"bar\"\n  transaction.incr \"baz\"\nend\n# =\u003e [\"OK\", 1]\n```\n\n### Futures\n\nReplies to commands in a pipeline can be accessed via the *futures* they\nemit. All calls on the pipeline object return a\n`Future` object, which responds to the `#value` method. When the\npipeline has successfully executed, all futures are assigned their\nrespective replies and can be used.\n\n```ruby\nset = incr = nil\nredis.pipelined do |pipeline|\n  set = pipeline.set \"foo\", \"bar\"\n  incr = pipeline.incr \"baz\"\nend\n\nset.value\n# =\u003e \"OK\"\n\nincr.value\n# =\u003e 1\n```\n\n## Error Handling\n\nIn general, if something goes wrong you'll get an exception. For example, if\nit can't connect to the server a `Redis::CannotConnectError` error will be raised.\n\n```ruby\nbegin\n  redis.ping\nrescue Redis::BaseError =\u003e e\n  e.inspect\n# =\u003e #\u003cRedis::CannotConnectError: Timed out connecting to Redis on 10.0.1.1:6380\u003e\n\n  e.message\n# =\u003e Timed out connecting to Redis on 10.0.1.1:6380\nend\n```\n\nSee lib/redis/errors.rb for information about what exceptions are possible.\n\n## Timeouts\n\nThe client allows you to configure connect, read, and write timeouts.\nStarting in version 5.0, the default for each is 1. Before that, it was 5.\nPassing a single `timeout` option will set all three values:\n\n```ruby\nRedis.new(:timeout =\u003e 1)\n```\n\nBut you can use specific values for each of them:\n\n```ruby\nRedis.new(\n  :connect_timeout =\u003e 0.2,\n  :read_timeout    =\u003e 1.0,\n  :write_timeout   =\u003e 0.5\n)\n```\n\nAll timeout values are specified in seconds.\n\nWhen using pub/sub, you can subscribe to a channel using a timeout as well:\n\n```ruby\nredis = Redis.new(reconnect_attempts: 0)\nredis.subscribe_with_timeout(5, \"news\") do |on|\n  on.message do |channel, message|\n    # ...\n  end\nend\n```\n\nIf no message is received after 5 seconds, the client will unsubscribe.\n\n## Reconnections\n\n**By default**, this gem will only **retry a connection once** and then fail, but\nthe client allows you to configure how many `reconnect_attempts` it should\ncomplete before declaring a connection as failed.\n\n```ruby\nRedis.new(reconnect_attempts: 0)\nRedis.new(reconnect_attempts: 3)\n```\n\nIf you wish to wait between reconnection attempts, you can instead pass a list\nof durations:\n\n```ruby\nRedis.new(reconnect_attempts: [\n  0, # retry immediately\n  0.25, # retry a second time after 250ms\n  1, # retry a third and final time after another 1s\n])\n```\n\nIf you wish to disable reconnection only for some commands, you can use\n`disable_reconnection`:\n\n```ruby\nredis.get(\"some-key\") # this may be retried\nredis.disable_reconnection do\n  redis.incr(\"some-counter\") # this won't be retried.\nend\n```\n\n## SSL/TLS Support\n\nTo enable SSL support, pass the `:ssl =\u003e true` option when configuring the\nRedis client, or pass in `:url =\u003e \"rediss://...\"` (like HTTPS for Redis).\nYou will also need to pass in an `:ssl_params =\u003e { ... }` hash used to\nconfigure the `OpenSSL::SSL::SSLContext` object used for the connection:\n\n```ruby\nredis = Redis.new(\n  :url        =\u003e \"rediss://:p4ssw0rd@10.0.1.1:6381/15\",\n  :ssl_params =\u003e {\n    :ca_file =\u003e \"/path/to/ca.crt\"\n  }\n)\n```\n\nThe options given to `:ssl_params` are passed directly to the\n`OpenSSL::SSL::SSLContext#set_params` method and can be any valid attribute\nof the SSL context. Please see the [OpenSSL::SSL::SSLContext documentation]\nfor all of the available attributes.\n\nHere is an example of passing in params that can be used for SSL client\ncertificate authentication (a.k.a. mutual TLS):\n\n```ruby\nredis = Redis.new(\n  :url        =\u003e \"rediss://:p4ssw0rd@10.0.1.1:6381/15\",\n  :ssl_params =\u003e {\n    :ca_file =\u003e \"/path/to/ca.crt\",\n    :cert    =\u003e OpenSSL::X509::Certificate.new(File.read(\"client.crt\")),\n    :key     =\u003e OpenSSL::PKey::RSA.new(File.read(\"client.key\"))\n  }\n)\n```\n\n[OpenSSL::SSL::SSLContext documentation]: http://ruby-doc.org/stdlib-2.5.0/libdoc/openssl/rdoc/OpenSSL/SSL/SSLContext.html\n\n## Expert-Mode Options\n\n - `inherit_socket: true`: disable safety check that prevents a forked child\n   from sharing a socket with its parent; this is potentially useful in order to mitigate connection churn when:\n    - many short-lived forked children of one process need to talk\n      to redis, AND\n    - your own code prevents the parent process from using the redis\n      connection while a child is alive\n\n   Improper use of `inherit_socket` will result in corrupted and/or incorrect\n   responses.\n\n## hiredis binding\n\nBy default, redis-rb uses Ruby's socket library to talk with Redis.\n\nThe hiredis driver uses the connection facility of hiredis-rb. In turn,\nhiredis-rb is a binding to the official hiredis client library. It\noptimizes for speed, at the cost of portability. Because it is a C\nextension, JRuby is not supported (by default).\n\nIt is best to use hiredis when you have large replies (for example:\n`LRANGE`, `SMEMBERS`, `ZRANGE`, etc.) and/or use big pipelines.\n\nIn your Gemfile, include `hiredis-client`:\n\n```ruby\ngem \"redis\"\ngem \"hiredis-client\"\n```\n\nIf your application doesn't call `Bundler.require`, you may have\nto require it explicitly:\n\n```ruby\nrequire \"hiredis-client\"\n````\n\nThis makes the hiredis driver the default.\n\nIf you want to be certain hiredis is being used, when instantiating\nthe client object, specify hiredis:\n\n```ruby\nredis = Redis.new(driver: :hiredis)\n```\n\n## Testing\n\nThis library is tested against recent Ruby and Redis versions.\nCheck [Github Actions][gh-actions-link] for the exact versions supported.\n\n## See Also\n\n- [async-redis](https://github.com/socketry/async-redis) — An [async](https://github.com/socketry/async) compatible Redis client.\n\n## Contributors\n\nSeveral people contributed to redis-rb, but we would like to especially\nmention Ezra Zygmuntowicz. Ezra introduced the Ruby community to many\nnew cool technologies, like Redis. He wrote the first version of this\nclient and evangelized Redis in Rubyland. Thank you, Ezra.\n\n## Contributing\n\n[Fork the project](https://github.com/redis/redis-rb) and send pull\nrequests.\n\n\n[rdoc-master-image]: https://img.shields.io/badge/docs-rdoc.info-blue.svg\n[rdoc-master-link]:  https://rubydoc.info/github/redis/redis-rb\n[redis-commands]:    https://redis.io/commands\n[redis-home]:        https://redis.io\n[redis-url]:         https://www.iana.org/assignments/uri-schemes/prov/redis\n[gh-actions-image]:  https://github.com/redis/redis-rb/workflows/Test/badge.svg\n[gh-actions-link]:   https://github.com/redis/redis-rb/actions\n[rubydoc]:           https://rubydoc.info/gems/redis\n","funding_links":[],"categories":["Data Persistence","Ruby","Database Drivers","Most Stars Project on Github"],"sub_categories":["Redis Clients"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredis%2Fredis-rb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredis%2Fredis-rb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredis%2Fredis-rb/lists"}