class Redis::Client
- Redis::Client
- Reference
- Object
Overview
The Redis client is the expected entrypoint for this shard. By default, it will connect to localhost:6379, but you can also supply a URI
to connect to an arbitrary Redis server. SSL, password authentication, and DB selection are all supported.
# Connects to localhost:6379
redis = Redis::Client.new
# Connects to a server at "redis.example.com" on port 6000 over a TLS
# connection, authenticates with the password "password", and uses DB 3
redis = Redis::Client.new(URI.parse("rediss://:[email protected]:6000/3"))
# Connects to a server at the URL in `ENV["REDIS_URL"]`
redis = Redis::Client.from_env("REDIS_URL")
Defined in:
client.crgraph.cr
json.cr
search.cr
time_series.cr
Constructors
-
.new(uri : URI = URI.parse(ENV.fetch("REDIS_URL", "redis:///")))
The client holds a pool of connections that expands and contracts as needed.
Class Method Summary
Instance Method Summary
-
#ft
EXPERIMENTAL RediSearch support is still under development. Some APIs may change while details are discovered.
-
#graph(key : String)
Instantiate a
Redis::Graph::Client
backed by thisRedis::Client
. -
#json
Return a
Redis::JSON
instance that wraps the currentRedis::Client
orRedis::Cluster
.EXPERIMENTAL Support for the RedisJSON module is still under development and subject to change.
-
#ts
Return a
Redis::TimeSeries
that wraps the currentRedis::Client
orRedis::Cluster
.
Macro Summary
-
method_missing(call)
All Redis commands invoked on the client check out a connection from the connection pool, invoke the command on that connection, and then check the connection back into the pool.
Constructor Detail
The client holds a pool of connections that expands and contracts as needed.
Class Method Detail
Instance Method Detail
EXPERIMENTAL RediSearch support is still under development. Some APIs may change while details are discovered.
Return a Redis::JSON
instance that wraps the current Redis::Client
or
Redis::Cluster
.
EXPERIMENTAL Support for the RedisJSON module is still under development and subject to change.
Macro Detail
All Redis commands invoked on the client check out a connection from the connection pool, invoke the command on that connection, and then check the connection back into the pool.
redis = Redis::Client.new