访问 Redis 服务
GitHub/redis/redis-rb
使用 Ruby 连接 Redis 服务、集群等等。
安装类库
连接集群
require "redis"
# Nodes can be passed to the client as an array of connection URLs.
nodes = (7000..7005).map { |port| "redis://127.0.0.1:#{port}" }
redis = Redis.new(cluster: nodes)
redis.set "foo" 7
redis.get "foo"