Classes

The following classes are available globally.

  • An object that operates in a First In, First Out (FIFO) request-response cycle.

    RedisCommandHandler is a NIO.ChannelDuplexHandler that sends RedisCommand instances to Redis, and fulfills the command’s NIO.EventLoopPromise as soon as a RESPValue response has been received from Redis.

    See more

    Declaration

    Swift

    public final class RedisCommandHandler
  • A concrete RedisClient implementation that represents an individual connection to a Redis database instance.

    For basic setups, you will just need a NIO.SocketAddress and a NIO.EventLoop and perhaps a password.

    let eventLoop: EventLoop = ...
    let connection = RedisConnection.connect(
        to: try .makeAddressResolvingHost("my.redis.url", port: RedisConnection.defaultPort),
        on: eventLoop
    ).wait()
    
    let result = try connection.set("my_key", to: "some value")
        .flatMap { return connection.get("my_key") }
        .wait()
    
    print(result) // Optional("some value")
    

    Note: wait() is used in the example for simplicity. Never call wait() on an event loop.

    See NIO.SocketAddress, NIO.EventLoop, and RedisClient

    See more

    Declaration

    Swift

    public final class RedisConnection : RedisClient
  • A specialized wrapper class for working with Metrics.Gauge objects for the purpose of an incrementing or decrementing count of active Redis connections.

    See more

    Declaration

    Swift

    public class ActiveConnectionGauge