Redis Documentation

Structure Request.​Redis

public struct Redis  
%3 Request.Redis Request.Redis RedisClient RedisClient Request.Redis->RedisClient

Conforms To

RedisClient

Properties

id

public let id: RedisID

event​Loop

public var eventLoop: EventLoop  

Methods

send(command:​with:​)

public func send(command: String, with arguments: [RESPValue]) async throws -> RESPValue  

subscribe(to:​message​Receiver:​on​Subscribe:​on​Unsubscribe:​)

public func subscribe(
        to channels: [RedisChannelName],
        messageReceiver receiver: @escaping RedisSubscriptionMessageReceiver,
        onSubscribe subscribeHandler: RedisSubscriptionChangeHandler?,
        onUnsubscribe unsubscribeHandler: RedisSubscriptionChangeHandler?
    ) async throws  

unsubscribe(from:​)

public func unsubscribe(from channels: [RedisChannelName]) async throws  

psubscribe(to:​message​Receiver:​on​Subscribe:​on​Unsubscribe:​)

public func psubscribe(
        to patterns: [String],
        messageReceiver receiver: @escaping RedisSubscriptionMessageReceiver,
        onSubscribe subscribeHandler: RedisSubscriptionChangeHandler?,
        onUnsubscribe unsubscribeHandler: RedisSubscriptionChangeHandler?
    ) async throws  

punsubscribe(from:​)

public func punsubscribe(from patterns: [String]) async throws  

logging(to:​)

public func logging(to logger: Logger) -> RedisClient  

send(command:​with:​)

public func send(command: String, with arguments: [RESPValue]) -> EventLoopFuture<RESPValue>  

subscribe(to:​message​Receiver:​on​Subscribe:​on​Unsubscribe:​)

public func subscribe(
        to channels: [RedisChannelName],
        messageReceiver receiver: @escaping RedisSubscriptionMessageReceiver,
        onSubscribe subscribeHandler: RedisSubscriptionChangeHandler?,
        onUnsubscribe unsubscribeHandler: RedisSubscriptionChangeHandler?
    ) -> EventLoopFuture<Void>  

unsubscribe(from:​)

public func unsubscribe(from channels: [RedisChannelName]) -> EventLoopFuture<Void>  

psubscribe(to:​message​Receiver:​on​Subscribe:​on​Unsubscribe:​)

public func psubscribe(
        to patterns: [String],
        messageReceiver receiver: @escaping RedisSubscriptionMessageReceiver,
        onSubscribe subscribeHandler: RedisSubscriptionChangeHandler?,
        onUnsubscribe unsubscribeHandler: RedisSubscriptionChangeHandler?
    ) -> EventLoopFuture<Void>  

punsubscribe(from:​)

public func punsubscribe(from patterns: [String]) -> EventLoopFuture<Void>  

with​Borrowed​Client(_:​)

@inlinable
    public func withBorrowedClient<Result>(
        _ operation: @escaping (RedisClient) -> EventLoopFuture<Result>
    ) -> EventLoopFuture<Result>  

Provides temporary exclusive access to a single Redis client.

See RedisConnectionPool.leaseConnection(_:) for more details.