diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5bfa108a..5e3a0f1a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ concurrency: cancel-in-progress: true env: - REDIS_HOSTNAME: redis + VALKEY_HOSTNAME: valkey jobs: linux: runs-on: ubuntu-latest @@ -25,11 +25,11 @@ jobs: container: image: ${{ matrix.image }} services: - redis: - image: redis + valkey: + image: valkey/valkey:8.0 ports: - 6379:6379 - options: --entrypoint redis-server + options: --entrypoint valkey-server steps: - name: Checkout uses: actions/checkout@v4 @@ -39,7 +39,7 @@ jobs: - name: Convert coverage files run: | llvm-cov export -format="lcov" \ - .build/debug/swift-redisPackageTests.xctest \ + .build/debug/swift-valkeyPackageTests.xctest \ -ignore-filename-regex="\/Tests\/" \ -instr-profile .build/debug/codecov/default.profdata > info.lcov - name: Upload to codecov.io diff --git a/Package.swift b/Package.swift index 39e5211d..aeded741 100644 --- a/Package.swift +++ b/Package.swift @@ -4,11 +4,10 @@ import PackageDescription let package = Package( - name: "swift-redis", + name: "swift-valkey", platforms: [.macOS(.v13)], products: [ - .library(name: "Redis", targets: ["Redis"]), - .library(name: "RedisCommands", targets: ["RedisCommands"]), + .library(name: "Valkey", targets: ["Valkey"]) ], dependencies: [ .package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"), @@ -18,7 +17,7 @@ let package = Package( ], targets: [ .target( - name: "Redis", + name: "Valkey", dependencies: [ .product(name: "Logging", package: "swift-log"), .product(name: "NIOCore", package: "swift-nio"), @@ -27,25 +26,18 @@ let package = Package( .product(name: "NIOTransportServices", package: "swift-nio-transport-services"), ] ), - .target( - name: "RedisCommands", - dependencies: [ - "Redis", - .product(name: "NIOCore", package: "swift-nio"), - ] - ), .executableTarget( - name: "RedisCommandsBuilder", + name: "ValkeyCommandsBuilder", resources: [.process("Resources")] ), .testTarget( - name: "RedisTests", - dependencies: ["Redis", "RedisCommands"] + name: "ValkeyTests", + dependencies: ["Valkey"] ), .testTarget( name: "RESPTests", dependencies: [ - "Redis", + "Valkey", .product(name: "NIOTestUtils", package: "swift-nio"), ] ), diff --git a/README.md b/README.md index 7d18d7d2..ca61d7b8 100644 --- a/README.md +++ b/README.md @@ -1,58 +1,37 @@ -# Redis +# Valkey -Redis client. +Valkey client. This is currently in an unfinished state. It has no connection manager so there is no support for connection reuse. ## Usage -To create a connection to Redis database you use `RedisClient.withConnection()`. +To create a connection to Valkey database you use `ValkeyClient.withConnection()`. ```swift -try await RedisClient.withConnection(.hostname("localhost", port: 6379), logger: logger) { connection, logger in - try await doRedisStuff() +try await ValkeyClient.withConnection(.hostname("localhost", port: 6379), logger: logger) { connection, logger in + try await doValkeyStuff() } ``` -Swift-redis has three ways to send commands. - -### Raw - -You can send raw commands using `RedisConnection.send()`. This takes a parameter pack of types that conform to `RESPRenderable`. These includes `Int`, `String`, `Double`, `RedisKey` and then `Optional` and `Array` where the internal type is also `RedisRenderable`. For example to set a value you can call - -```swift -let key = RedisKey(rawValue: "MyKey") -try await connection.send("SET", key, "TestString") -``` - -A raw send will return a `RESPToken`. This can be converted to any value that conforms to `RESPTokenRepresentable`. As with `RESPRenderable` these covers many standard types. You can convert from a `RESPToken` to `RESPTokenRepresentable` type by either using the constructor `init(from: RESPToken)` or the function `converting(to:)`. - -```swift -let response = try await connection.send("GET", key) -let value = try response.converting(to: String.self) -// you could also use `let value = String(from: response)` -``` - -### Using generated functions - -Swift-redis includes a separate module `RedisCommands` that includes functions for all the redis commands. These are generated from the model files redis supplies in [redis-doc](https://github.com/redis/redis-doc). Instead of searching up in the documentation how a command is structured. You can just call a Swift function. In many cases where it is possible the return type from these functions is the set to the be the expected type. In situations where the type cannot be ascertained a `RESPToken` is returned and you'll need to convert the return type manually. - -With the generated functions the code above becomes +All the Valkey commands are in the Commands folder of the Valkey target. These are generated from the model files Valkey supplies in [valkey-doc](https://github.com/valkey-io/valkey-doc). In many cases where it was possible to ascertain the return type of a command these functions will return that expected type. In situations where this is not possible a `RESPToken` is returned and you'll need to convert the return type manually. ```swift -let key = RedisKey(rawValue: "MyKey") -try await connection.set(key, "TestString") +try await connection.set("MyKey", "TestString") let value = try await connection.get(key) ``` -### Using generated RESPCommands and pipelining +### Pipelining commands -In general you don't need to use this method as it has no advantages over using the generated functions. But `RESPCommands` has a function for each Redis command. Where the generated `RESPCommands` are useful is if you want to pipeline commands ie send multiple commands batched together and only wait for all of their responses in one place. You could pipeline the two commands above using +In some cases it desirable to send multiple commands at one time, without waiting for each response after each command. This is called pipelining. You can do this using the function `pipeline(_:)`. This takes a parameter pack of commands and returns a parameter pack with the responses once all the commands have executed. ```swift -let key = RedisKey(rawValue: "MyKey") let (setResponse, getResponse) = try await connection.pipeline( - SET(key, "TestString"), - GET(key) + SET("MyKey", "TestString"), + GET("MyKey") ) ``` + +## Redis compatibilty + +As Valkey is a fork of Redis v7.2.4, swift-valkey is compatible with Redis databases up to v7.2.4. There is a chance the v7.2.4 features will still be compatible in later versions of Redis, but these are now considered two different projects and they will diverge. Swift-valkey uses the RESP3 protocol. It does not support RESP2. \ No newline at end of file diff --git a/Sources/RedisCommands/SetCommands.swift b/Sources/RedisCommands/SetCommands.swift deleted file mode 100644 index 76b12837..00000000 --- a/Sources/RedisCommands/SetCommands.swift +++ /dev/null @@ -1,528 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the swift-redis open source project -// -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -// This file is autogenerated by RedisCommandsBuilder - -import NIOCore -import Redis - -#if canImport(FoundationEssentials) -import FoundationEssentials -#else -import Foundation -#endif - -/// Adds one or more members to a set. Creates the key if it doesn't exist. -public struct SADD: RedisCommand { - public typealias Response = Int - - public var key: RedisKey - public var member: [String] - - @inlinable public init(key: RedisKey, member: [String]) { - self.key = key - self.member = member - } - - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("SADD", key, member) - } -} - -/// Returns the number of members in a set. -public struct SCARD: RedisCommand { - public typealias Response = Int - - public var key: RedisKey - - @inlinable public init(key: RedisKey) { - self.key = key - } - - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("SCARD", key) - } -} - -/// Returns the difference of multiple sets. -public struct SDIFF: RedisCommand { - public typealias Response = [RESPToken] - - public var key: [RedisKey] - - @inlinable public init(key: [RedisKey]) { - self.key = key - } - - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("SDIFF", key) - } -} - -/// Stores the difference of multiple sets in a key. -public struct SDIFFSTORE: RedisCommand { - public typealias Response = Int - - public var destination: RedisKey - public var key: [RedisKey] - - @inlinable public init(destination: RedisKey, key: [RedisKey]) { - self.destination = destination - self.key = key - } - - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("SDIFFSTORE", destination, key) - } -} - -/// Returns the intersect of multiple sets. -public struct SINTER: RedisCommand { - public typealias Response = [RESPToken] - - public var key: [RedisKey] - - @inlinable public init(key: [RedisKey]) { - self.key = key - } - - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("SINTER", key) - } -} - -/// Returns the number of members of the intersect of multiple sets. -public struct SINTERCARD: RedisCommand { - public typealias Response = Int - - public var key: [RedisKey] - public var limit: Int? = nil - - @inlinable public init(key: [RedisKey], limit: Int? = nil) { - self.key = key - self.limit = limit - } - - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("SINTERCARD", RESPArrayWithCount(key), RESPWithToken("LIMIT", limit)) - } -} - -/// Stores the intersect of multiple sets in a key. -public struct SINTERSTORE: RedisCommand { - public typealias Response = Int - - public var destination: RedisKey - public var key: [RedisKey] - - @inlinable public init(destination: RedisKey, key: [RedisKey]) { - self.destination = destination - self.key = key - } - - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("SINTERSTORE", destination, key) - } -} - -/// Determines whether a member belongs to a set. -public struct SISMEMBER: RedisCommand { - public typealias Response = Int - - public var key: RedisKey - public var member: String - - @inlinable public init(key: RedisKey, member: String) { - self.key = key - self.member = member - } - - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("SISMEMBER", key, member) - } -} - -/// Returns all members of a set. -public struct SMEMBERS: RedisCommand { - public typealias Response = [RESPToken] - - public var key: RedisKey - - @inlinable public init(key: RedisKey) { - self.key = key - } - - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("SMEMBERS", key) - } -} - -/// Determines whether multiple members belong to a set. -public struct SMISMEMBER: RedisCommand { - public typealias Response = [RESPToken] - - public var key: RedisKey - public var member: [String] - - @inlinable public init(key: RedisKey, member: [String]) { - self.key = key - self.member = member - } - - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("SMISMEMBER", key, member) - } -} - -/// Moves a member from one set to another. -public struct SMOVE: RedisCommand { - public typealias Response = Int - - public var source: RedisKey - public var destination: RedisKey - public var member: String - - @inlinable public init(source: RedisKey, destination: RedisKey, member: String) { - self.source = source - self.destination = destination - self.member = member - } - - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("SMOVE", source, destination, member) - } -} - -/// Returns one or more random members from a set after removing them. Deletes the set if the last member was popped. -public struct SPOP: RedisCommand { - public typealias Response = RESPToken - - public var key: RedisKey - public var count: Int? = nil - - @inlinable public init(key: RedisKey, count: Int? = nil) { - self.key = key - self.count = count - } - - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("SPOP", key, count) - } -} - -/// Get one or multiple random members from a set -public struct SRANDMEMBER: RedisCommand { - public typealias Response = RESPToken - - public var key: RedisKey - public var count: Int? = nil - - @inlinable public init(key: RedisKey, count: Int? = nil) { - self.key = key - self.count = count - } - - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("SRANDMEMBER", key, count) - } -} - -/// Removes one or more members from a set. Deletes the set if the last member was removed. -public struct SREM: RedisCommand { - public typealias Response = Int - - public var key: RedisKey - public var member: [String] - - @inlinable public init(key: RedisKey, member: [String]) { - self.key = key - self.member = member - } - - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("SREM", key, member) - } -} - -/// Iterates over members of a set. -public struct SSCAN: RedisCommand { - public typealias Response = [RESPToken] - - public var key: RedisKey - public var cursor: Int - public var pattern: String? = nil - public var count: Int? = nil - - @inlinable public init(key: RedisKey, cursor: Int, pattern: String? = nil, count: Int? = nil) { - self.key = key - self.cursor = cursor - self.pattern = pattern - self.count = count - } - - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("SSCAN", key, cursor, RESPWithToken("MATCH", pattern), RESPWithToken("COUNT", count)) - } -} - -/// Returns the union of multiple sets. -public struct SUNION: RedisCommand { - public typealias Response = [RESPToken] - - public var key: [RedisKey] - - @inlinable public init(key: [RedisKey]) { - self.key = key - } - - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("SUNION", key) - } -} - -/// Stores the union of multiple sets in a key. -public struct SUNIONSTORE: RedisCommand { - public typealias Response = Int - - public var destination: RedisKey - public var key: [RedisKey] - - @inlinable public init(destination: RedisKey, key: [RedisKey]) { - self.destination = destination - self.key = key - } - - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("SUNIONSTORE", destination, key) - } -} - - -extension RedisConnection { - /// Adds one or more members to a set. Creates the key if it doesn't exist. - /// - /// - Documentation: [SADD](https:/redis.io/docs/latest/commands/sadd) - /// - Version: 1.0.0 - /// - Complexity: O(1) for each element added, so O(N) to add N elements when the command is called with multiple arguments. - /// - Categories: @write, @set, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of elements that were added to the set, not including all the elements already present in the set. - @inlinable - public func sadd(key: RedisKey, member: [String]) async throws -> Int { - try await send(command: SADD(key: key, member: member)) - } - - /// Returns the number of members in a set. - /// - /// - Documentation: [SCARD](https:/redis.io/docs/latest/commands/scard) - /// - Version: 1.0.0 - /// - Complexity: O(1) - /// - Categories: @read, @set, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): The cardinality (number of elements) of the set, or 0 if the key does not exist. - @inlinable - public func scard(key: RedisKey) async throws -> Int { - try await send(command: SCARD(key: key)) - } - - /// Returns the difference of multiple sets. - /// - /// - Documentation: [SDIFF](https:/redis.io/docs/latest/commands/sdiff) - /// - Version: 1.0.0 - /// - Complexity: O(N) where N is the total number of elements in all given sets. - /// - Categories: @read, @set, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list with the members of the resulting set. - @inlinable - public func sdiff(key: [RedisKey]) async throws -> [RESPToken] { - try await send(command: SDIFF(key: key)) - } - - /// Stores the difference of multiple sets in a key. - /// - /// - Documentation: [SDIFFSTORE](https:/redis.io/docs/latest/commands/sdiffstore) - /// - Version: 1.0.0 - /// - Complexity: O(N) where N is the total number of elements in all given sets. - /// - Categories: @write, @set, @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of elements in the resulting set. - @inlinable - public func sdiffstore(destination: RedisKey, key: [RedisKey]) async throws -> Int { - try await send(command: SDIFFSTORE(destination: destination, key: key)) - } - - /// Returns the intersect of multiple sets. - /// - /// - Documentation: [SINTER](https:/redis.io/docs/latest/commands/sinter) - /// - Version: 1.0.0 - /// - Complexity: O(N*M) worst case where N is the cardinality of the smallest set and M is the number of sets. - /// - Categories: @read, @set, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list with the members of the resulting set. - @inlinable - public func sinter(key: [RedisKey]) async throws -> [RESPToken] { - try await send(command: SINTER(key: key)) - } - - /// Returns the number of members of the intersect of multiple sets. - /// - /// - Documentation: [SINTERCARD](https:/redis.io/docs/latest/commands/sintercard) - /// - Version: 7.0.0 - /// - Complexity: O(N*M) worst case where N is the cardinality of the smallest set and M is the number of sets. - /// - Categories: @read, @set, @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of the elements in the resulting intersection. - @inlinable - public func sintercard(key: [RedisKey], limit: Int? = nil) async throws -> Int { - try await send(command: SINTERCARD(key: key, limit: limit)) - } - - /// Stores the intersect of multiple sets in a key. - /// - /// - Documentation: [SINTERSTORE](https:/redis.io/docs/latest/commands/sinterstore) - /// - Version: 1.0.0 - /// - Complexity: O(N*M) worst case where N is the cardinality of the smallest set and M is the number of sets. - /// - Categories: @write, @set, @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of the elements in the result set. - @inlinable - public func sinterstore(destination: RedisKey, key: [RedisKey]) async throws -> Int { - try await send(command: SINTERSTORE(destination: destination, key: key)) - } - - /// Determines whether a member belongs to a set. - /// - /// - Documentation: [SISMEMBER](https:/redis.io/docs/latest/commands/sismember) - /// - Version: 1.0.0 - /// - Complexity: O(1) - /// - Categories: @read, @set, @fast - /// - Returns: One of the following: - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `0` if the element is not a member of the set, or when the key does not exist. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `1` if the element is a member of the set. - @inlinable - public func sismember(key: RedisKey, member: String) async throws -> Int { - try await send(command: SISMEMBER(key: key, member: member)) - } - - /// Returns all members of a set. - /// - /// - Documentation: [SMEMBERS](https:/redis.io/docs/latest/commands/smembers) - /// - Version: 1.0.0 - /// - Complexity: O(N) where N is the set cardinality. - /// - Categories: @read, @set, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): all members of the set. - @inlinable - public func smembers(key: RedisKey) async throws -> [RESPToken] { - try await send(command: SMEMBERS(key: key)) - } - - /// Determines whether multiple members belong to a set. - /// - /// - Documentation: [SMISMEMBER](https:/redis.io/docs/latest/commands/smismember) - /// - Version: 6.2.0 - /// - Complexity: O(N) where N is the number of elements being checked for membership - /// - Categories: @read, @set, @fast - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list representing the membership of the given elements, in the same order as they are requested. - @inlinable - public func smismember(key: RedisKey, member: [String]) async throws -> [RESPToken] { - try await send(command: SMISMEMBER(key: key, member: member)) - } - - /// Moves a member from one set to another. - /// - /// - Documentation: [SMOVE](https:/redis.io/docs/latest/commands/smove) - /// - Version: 1.0.0 - /// - Complexity: O(1) - /// - Categories: @write, @set, @fast - /// - Returns: One of the following: - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `1` if the element is moved. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `0` if the element is not a member of _source_ and no operation was performed. - @inlinable - public func smove(source: RedisKey, destination: RedisKey, member: String) async throws -> Int { - try await send(command: SMOVE(source: source, destination: destination, member: member)) - } - - /// Returns one or more random members from a set after removing them. Deletes the set if the last member was popped. - /// - /// - Documentation: [SPOP](https:/redis.io/docs/latest/commands/spop) - /// - Version: 1.0.0 - /// - Complexity: Without the count argument O(1), otherwise O(N) where N is the value of the passed count. - /// - Categories: @write, @set, @fast - /// - Returns: One of the following: - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): if the key does not exist. - /// * [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): when called without the _count_ argument, the removed member. - /// * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): when called with the _count_ argument, a list of the removed members. - @inlinable - public func spop(key: RedisKey, count: Int? = nil) async throws -> RESPToken { - try await send(command: SPOP(key: key, count: count)) - } - - /// Get one or multiple random members from a set - /// - /// - Documentation: [SRANDMEMBER](https:/redis.io/docs/latest/commands/srandmember) - /// - Version: 1.0.0 - /// - Complexity: Without the count argument O(1), otherwise O(N) where N is the absolute value of the passed count. - /// - Categories: @read, @set, @slow - /// - Returns: One of the following: - /// * [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): without the additional _count_ argument, the command returns a randomly selected member, or a [Null](https:/redis.io/docs/reference/protocol-spec#nulls) when _key_ doesn't exist. - /// * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): when the optional _count_ argument is passed, the command returns an array of members, or an empty array when _key_ doesn't exist. - @inlinable - public func srandmember(key: RedisKey, count: Int? = nil) async throws -> RESPToken { - try await send(command: SRANDMEMBER(key: key, count: count)) - } - - /// Removes one or more members from a set. Deletes the set if the last member was removed. - /// - /// - Documentation: [SREM](https:/redis.io/docs/latest/commands/srem) - /// - Version: 1.0.0 - /// - Complexity: O(N) where N is the number of members to be removed. - /// - Categories: @write, @set, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): Number of members that were removed from the set, not including non existing members. - @inlinable - public func srem(key: RedisKey, member: [String]) async throws -> Int { - try await send(command: SREM(key: key, member: member)) - } - - /// Iterates over members of a set. - /// - /// - Documentation: [SSCAN](https:/redis.io/docs/latest/commands/sscan) - /// - Version: 2.8.0 - /// - Complexity: O(1) for every call. O(N) for a complete iteration, including enough command calls for the cursor to return back to 0. N is the number of elements inside the collection. - /// - Categories: @read, @set, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): specifically, an array with two elements: - /// * The first element is a [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings) that represents an unsigned 64-bit number, the cursor. - /// * The second element is an [Array](https:/redis.io/docs/reference/protocol-spec#arrays) with the names of scanned members. - @inlinable - public func sscan(key: RedisKey, cursor: Int, pattern: String? = nil, count: Int? = nil) async throws -> [RESPToken] { - try await send(command: SSCAN(key: key, cursor: cursor, pattern: pattern, count: count)) - } - - /// Returns the union of multiple sets. - /// - /// - Documentation: [SUNION](https:/redis.io/docs/latest/commands/sunion) - /// - Version: 1.0.0 - /// - Complexity: O(N) where N is the total number of elements in all given sets. - /// - Categories: @read, @set, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list with the members of the resulting set. - @inlinable - public func sunion(key: [RedisKey]) async throws -> [RESPToken] { - try await send(command: SUNION(key: key)) - } - - /// Stores the union of multiple sets in a key. - /// - /// - Documentation: [SUNIONSTORE](https:/redis.io/docs/latest/commands/sunionstore) - /// - Version: 1.0.0 - /// - Complexity: O(N) where N is the total number of elements in all given sets. - /// - Categories: @write, @set, @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): Number of the elements in the resulting set. - @inlinable - public func sunionstore(destination: RedisKey, key: [RedisKey]) async throws -> Int { - try await send(command: SUNIONSTORE(destination: destination, key: key)) - } - -} diff --git a/Sources/RedisCommandsBuilder/Resources/resp3_replies.json b/Sources/RedisCommandsBuilder/Resources/resp3_replies.json deleted file mode 100644 index 4846a18d..00000000 --- a/Sources/RedisCommandsBuilder/Resources/resp3_replies.json +++ /dev/null @@ -1,1386 +0,0 @@ -{ - "ACL": [], - "ACL CAT": [ - "One of the following:", - "* [Array reply](/docs/reference/protocol-spec#arrays): an array of [Bulk string reply](/docs/reference/protocol-spec#bulk-strings) elements representing ACL categories or commands in a given category.", - "* [Simple error reply](/docs/reference/protocol-spec#simple-errors): the command returns an error if an invalid category name is given." - ], - "ACL DELUSER": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of users that were deleted. This number will not always match the number of arguments since certain users may not exist." - ], - "ACL DRYRUN": [ - "Any of the following:", - "* [Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` on success.", - "* [Bulk string reply](/docs/reference/protocol-spec#bulk-strings): an error describing why the user can't execute the command." - ], - "ACL GENPASS": [ - "[Bulk string reply](/docs/reference/protocol-spec#bulk-strings): pseudorandom data. By default it contains 64 bytes, representing 256 bits of data. If `bits` was given, the output string length is the number of specified bits (rounded to the next multiple of 4) divided by 4." - ], - "ACL GETUSER": [ - "One of the following:", - "* [Map reply](/docs/reference/protocol-spec#maps): a set of ACL rule definitions for the user", - "* [Null reply](/docs/reference/protocol-spec#nulls): if user does not exist." - ], - "ACL HELP": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of subcommands and their descriptions." - ], - "ACL LIST": [ - "[Array reply](/docs/reference/protocol-spec#arrays): an array of [Bulk string reply](/docs/reference/protocol-spec#bulk-strings) elements." - ], - "ACL LOAD": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` on success.", - "", - "The command may fail with an error for several reasons: if the file is not readable, if there is an error inside the file, and in such cases, the error will be reported to the user in the error.", - "Finally, the command will fail if the server is not configured to use an external ACL file." - ], - "ACL LOG": [ - "When called to show security events:", - "* [Array reply](/docs/reference/protocol-spec#arrays): an array of [Bulk string reply](/docs/reference/protocol-spec#bulk-strings) elements representing ACL security events.", - "When called with `RESET`:", - "* [Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` if the security log was cleared." - ], - "ACL SAVE": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`.", - "The command may fail with an error for several reasons: if the file cannot be written or if the server is not configured to use an external ACL file." - ], - "ACL SETUSER": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`.", - "If the rules contain errors, the error is returned." - ], - "ACL USERS": [ - "[Array reply](/docs/reference/protocol-spec#arrays): list of existing ACL users." - ], - "ACL WHOAMI": [ - "[Bulk string reply](/docs/reference/protocol-spec#bulk-strings): the username of the current connection." - ], - "APPEND": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the length of the string after the append operation." - ], - "ASKING": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "AUTH": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`, or an error if the password, or username/password pair, is invalid." - ], - "BGREWRITEAOF": [ - "[Bulk string reply](/docs/reference/protocol-spec#bulk-strings): a simple string reply indicating that the rewriting started or is about to start ASAP when the call is executed with success.", - "", - "The command may reply with an error in certain cases, as documented above." - ], - "BGSAVE": [ - "One of the following:", - "* [Simple string reply](/docs/reference/protocol-spec#simple-strings): `Background saving started`.", - "* [Simple string reply](/docs/reference/protocol-spec#simple-strings): `Background saving scheduled`." - ], - "BITCOUNT": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of bits set to 1." - ], - "BITFIELD": [ - "One of the following:", - "* [Array reply](/docs/reference/protocol-spec#arrays): each entry being the corresponding result of the sub-command given at the same position.", - "* [Null reply](/docs/reference/protocol-spec#nulls): if OVERFLOW FAIL was given and overflows or underflows are detected." - ], - "BITFIELD_RO": [ - "[Array reply](/docs/reference/protocol-spec#arrays): each entry being the corresponding result of the sub-command given at the same position." - ], - "BITOP": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the size of the string stored in the destination key is equal to the size of the longest input string." - ], - "BITPOS": [ - "One of the following:", - "* [Integer reply](/docs/reference/protocol-spec#integers): the position of the first bit set to 1 or 0 according to the request", - "* [Integer reply](/docs/reference/protocol-spec#integers): `-1`. In case the `bit` argument is 1 and the string is empty or composed of just zero bytes", - "", - "If we look for set bits (the bit argument is 1) and the string is empty or composed of just zero bytes, -1 is returned.", - "", - "If we look for clear bits (the bit argument is 0) and the string only contains bits set to 1, the function returns the first bit not part of the string on the right. So if the string is three bytes set to the value `0xff` the command `BITPOS key 0` will return 24, since up to bit 23 all the bits are 1.", - "", - "The function considers the right of the string as padded with zeros if you look for clear bits and specify no range or the _start_ argument **only**.", - "", - "However, this behavior changes if you are looking for clear bits and specify a range with both _start_ and _end_.", - "If a clear bit isn't found in the specified range, the function returns -1 as the user specified a clear range and there are no 0 bits in that range." - ], - "BLMOVE": [ - "One of the following:", - "* [Bulk string reply](/docs/reference/protocol-spec#bulk-strings): the element being popped from the _source_ and pushed to the _destination_.", - "* [Null reply](/docs/reference/protocol-spec#nulls): the operation timed-out" - ], - "BLMPOP": [ - "One of the following:", - "* [Null reply](/docs/reference/protocol-spec#nulls): when no element could be popped and the _timeout_ is reached.", - "* [Array reply](/docs/reference/protocol-spec#arrays): a two-element array with the first element being the name of the key from which elements were popped, and the second element being an array of the popped elements." - ], - "BLPOP": [ - "One of the following:", - "* [Null reply](/docs/reference/protocol-spec#nulls): no element could be popped and the timeout expired", - "* [Array reply](/docs/reference/protocol-spec#arrays): the key from which the element was popped and the value of the popped element." - ], - "BRPOP": [ - "One of the following:", - "* [Null reply](/docs/reference/protocol-spec#nulls): no element could be popped and the timeout expired.", - "* [Array reply](/docs/reference/protocol-spec#arrays): the key from which the element was popped and the value of the popped element" - ], - "BRPOPLPUSH": [ - "One of the following:", - "* [Bulk string reply](/docs/reference/protocol-spec#bulk-strings): the element being popped from _source_ and pushed to _destination_.", - "* [Null reply](/docs/reference/protocol-spec#nulls): the timeout is reached." - ], - "BZMPOP": [ - "One of the following:", - "* [Null reply](/docs/reference/protocol-spec#nulls): when no element could be popped.", - "* [Array reply](/docs/reference/protocol-spec#arrays): a two-element array with the first element being the name of the key from which elements were popped, and the second element is an array of the popped elements. Every entry in the elements array is also an array that contains the member and its score." - ], - "BZPOPMAX": [ - "One of the following:", - "* [Null reply](/docs/reference/protocol-spec#nulls): when no element could be popped and the _timeout_ expired.", - "* [Array reply](/docs/reference/protocol-spec#arrays): the keyname, popped member, and its score." - ], - "BZPOPMIN": [ - "One of the following:", - "* [Null reply](/docs/reference/protocol-spec#nulls): when no element could be popped and the _timeout_ expired.", - "* [Array reply](/docs/reference/protocol-spec#arrays): the keyname, popped member, and its score." - ], - "CLIENT": [], - "CLIENT CACHING": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` or an error if the argument is not \"yes\" or \"no\"." - ], - "CLIENT GETNAME": [ - "One of the following:", - "* [Bulk string reply](/docs/reference/protocol-spec#bulk-strings): the connection name of the current connection.", - "* [Null reply](/docs/reference/protocol-spec#nulls): the connection name was not set." - ], - "CLIENT GETREDIR": [ - "One of the following:", - "* [Integer reply](/docs/reference/protocol-spec#integers): `0` when not redirecting notifications to any client.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `-1` if client tracking is not enabled.", - "* [Integer reply](/docs/reference/protocol-spec#integers): the ID of the client to which notification are being redirected." - ], - "CLIENT HELP": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of subcommands and their descriptions." - ], - "CLIENT ID": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the ID of the client." - ], - "CLIENT INFO": [ - "[Bulk string reply](/docs/reference/protocol-spec#bulk-strings): a unique string for the current client, as described at the `CLIENT LIST` page." - ], - "CLIENT KILL": [ - "One of the following:", - "* [Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` when called in 3 argument format and the connection has been closed.", - "* [Integer reply](/docs/reference/protocol-spec#integers): when called in filter/value format, the number of clients killed." - ], - "CLIENT LIST": [ - "[Bulk string reply](/docs/reference/protocol-spec#bulk-strings): information and statistics about client connections." - ], - "CLIENT NO-EVICT": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "CLIENT NO-TOUCH": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "CLIENT PAUSE": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` or an error if the timeout is invalid." - ], - "CLIENT REPLY": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` when called with `ON`. When called with either `OFF` or `SKIP` sub-commands, no reply is made." - ], - "CLIENT SETINFO": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` if the attribute name was successfully set." - ], - "CLIENT SETNAME": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` if the connection name was successfully set." - ], - "CLIENT TRACKING": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` if the connection was successfully put in tracking mode or if the tracking mode was successfully disabled. Otherwise, an error is returned." - ], - "CLIENT TRACKINGINFO": [ - "[Map reply](/docs/reference/protocol-spec#maps): a list of tracking information sections and their respective values." - ], - "CLIENT UNBLOCK": [ - "One of the following:", - "* [Integer reply](/docs/reference/protocol-spec#integers): `0` if the client was unblocked successfully.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `1` if the client wasn't unblocked." - ], - "CLIENT UNPAUSE": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "CLUSTER": [], - "CLUSTER ADDSLOTS": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` if the command was successful. Otherwise an error is returned." - ], - "CLUSTER ADDSLOTSRANGE": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` if the command was successful. Otherwise an error is returned." - ], - "CLUSTER BUMPEPOCH": [ - "One of the following:", - "* [Bulk string reply](/docs/reference/protocol-spec#bulk-strings): `BUMPED` if the epoch was incremented.", - "* [Bulk string reply](/docs/reference/protocol-spec#bulk-strings): `STILL` if the node already has the greatest configured epoch in the cluster." - ], - "CLUSTER COUNT-FAILURE-REPORTS": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of active failure reports for the node." - ], - "CLUSTER COUNTKEYSINSLOT": [ - "[Integer reply](/docs/reference/protocol-spec#integers): The number of keys in the specified hash slot, or an error if the hash slot is invalid." - ], - "CLUSTER DELSLOTS": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` if the command was successful. Otherwise an error is returned." - ], - "CLUSTER DELSLOTSRANGE": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` if the command was successful. Otherwise an error is returned." - ], - "CLUSTER FAILOVER": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` if the command was accepted and a manual failover is going to be attempted. An error if the operation cannot be executed, for example if the client is connected to a node that is already a master." - ], - "CLUSTER FLUSHSLOTS": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "CLUSTER FORGET": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` if the command was executed successfully. Otherwise an error is returned." - ], - "CLUSTER GETKEYSINSLOT": [ - "[Array reply](/docs/reference/protocol-spec#arrays): an array with up to count elements." - ], - "CLUSTER HELP": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of subcommands and their descriptions." - ], - "CLUSTER INFO": [ - "[Bulk string reply](/docs/reference/protocol-spec#bulk-strings): A map between named fields and values in the form of : lines separated by newlines composed by the two bytes CRLF" - ], - "CLUSTER KEYSLOT": [ - "[Integer reply](/docs/reference/protocol-spec#integers): The hash slot number for the specified key" - ], - "CLUSTER LINKS": [ - "[Array reply](/docs/reference/protocol-spec#arrays): an array of [Map reply](/docs/reference/protocol-spec#maps) where each map contains various attributes and their values of a cluster link." - ], - "CLUSTER MEET": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` if the command was successful. If the address or port specified are invalid an error is returned." - ], - "CLUSTER MYID": [ - "[Bulk string reply](/docs/reference/protocol-spec#bulk-strings): the node ID." - ], - "CLUSTER MYSHARDID": [ - "[Bulk string reply](/docs/reference/protocol-spec#bulk-strings): the node's shard ID." - ], - "CLUSTER NODES": [ - "[Bulk string reply](/docs/reference/protocol-spec#bulk-strings): the serialized cluster configuration." - ], - "CLUSTER REPLICAS": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of replica nodes replicating from the specified master node provided in the same format used by `CLUSTER NODES`." - ], - "CLUSTER REPLICATE": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` if the command was successful. Otherwise an error is returned." - ], - "CLUSTER RESET": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` if the command was successful. Otherwise an error is returned." - ], - "CLUSTER SAVECONFIG": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` if the command was successful. Otherwise an error is returned." - ], - "CLUSTER SET-CONFIG-EPOCH": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` if the command was successful. Otherwise an error is returned." - ], - "CLUSTER SETSLOT": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): all the sub-commands return `OK` if the command was successful. Otherwise an error is returned." - ], - "CLUSTER SHARDS": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a nested list of [Map reply](/docs/reference/protocol-spec#maps) of hash ranges and shard nodes describing individual shards." - ], - "CLUSTER SLAVES": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of replica nodes replicating from the specified master node provided in the same format used by `CLUSTER NODES`." - ], - "CLUSTER SLOTS": [ - "[Array reply](/docs/reference/protocol-spec#arrays): nested list of slot ranges with networking information." - ], - "COMMAND": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a nested list of command details. The order of the commands in the array is random." - ], - "COMMAND COUNT": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of commands returned by `COMMAND`." - ], - "COMMAND DOCS": [ - "[Map reply](/docs/reference/protocol-spec#maps): a map where each key is a command name, and each value is the documentary information." - ], - "COMMAND GETKEYS": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of keys from the given command." - ], - "COMMAND GETKEYSANDFLAGS": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of keys from the given command and their usage flags." - ], - "COMMAND HELP": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of sub-commands and their descriptions." - ], - "COMMAND INFO": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a nested list of command details." - ], - "COMMAND LIST": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of command names." - ], - "CONFIG": [], - "CONFIG GET": [ - "[Map reply](/docs/reference/protocol-spec#maps): a list of configuration parameters matching the provided arguments." - ], - "CONFIG HELP": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of sub-commands and their descriptions." - ], - "CONFIG RESETSTAT": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "CONFIG REWRITE": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` when the configuration was rewritten properly. Otherwise an error is returned." - ], - "CONFIG SET": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` when the configuration was set properly. Otherwise an error is returned." - ], - "COPY": [ - "One of the following:", - "* [Integer reply](/docs/reference/protocol-spec#integers): `1` if _source_ was copied.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `0` if _source_ was not copied." - ], - "DBSIZE": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of keys in the currently-selected database." - ], - "DEBUG": [], - "DECR": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the value of the key after decrementing it." - ], - "DECRBY": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the value of the key after decrementing it." - ], - "DEL": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of keys that were removed." - ], - "DISCARD": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "DUMP": [ - "One of the following:", - "* [Bulk string reply](/docs/reference/protocol-spec#bulk-strings): the serialized value of the key.", - "* [Null reply](/docs/reference/protocol-spec#nulls): the key does not exist." - ], - "ECHO": [ - "[Bulk string reply](/docs/reference/protocol-spec#bulk-strings): the given string." - ], - "EVAL": [ - "The return value depends on the script that was executed." - ], - "EVALSHA": [ - "The return value depends on the script that was executed." - ], - "EVALSHA_RO": [ - "The return value depends on the script that was executed." - ], - "EVAL_RO": [ - "The return value depends on the script that was executed." - ], - "EXEC": [ - "One of the following:", - "* [Array reply](/docs/reference/protocol-spec#arrays): each element being the reply to each of the commands in the atomic transaction.", - "* [Null reply](/docs/reference/protocol-spec#nulls): the transaction was aborted because a `WATCH`ed key was touched." - ], - "EXISTS": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of keys that exist from those specified as arguments." - ], - "EXPIRE": [ - "One of the following:", - "* [Integer reply](/docs/reference/protocol-spec#integers): `0` if the timeout was not set; for example, the key doesn't exist, or the operation was skipped because of the provided arguments.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `1` if the timeout was set." - ], - "EXPIREAT": [ - "One of the following:", - "* [Integer reply](/docs/reference/protocol-spec#integers): `0` if the timeout was not set; for example, the key doesn't exist, or the operation was skipped because of the provided arguments.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `1` if the timeout was set." - ], - "EXPIRETIME": [ - "One of the following:", - "* [Integer reply](/docs/reference/protocol-spec#integers): the expiration Unix timestamp in seconds.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `-1` if the key exists but has no associated expiration time.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `-2` if the key does not exist." - ], - "FAILOVER": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` if the command was accepted and a coordinated failover is in progress. An error if the operation cannot be executed." - ], - "FCALL": [ - "The return value depends on the function that was executed." - ], - "FCALL_RO": [ - "The return value depends on the function that was executed." - ], - "FLUSHALL": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "FLUSHDB": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "FUNCTION": [], - "FUNCTION DELETE": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "FUNCTION DUMP": [ - "[Bulk string reply](/docs/reference/protocol-spec#bulk-strings): the serialized payload" - ], - "FUNCTION FLUSH": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "FUNCTION HELP": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of sub-commands and their descriptions." - ], - "FUNCTION KILL": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "FUNCTION LIST": [ - "[Array reply](/docs/reference/protocol-spec#arrays): information about functions and libraries." - ], - "FUNCTION LOAD": [ - "[Bulk string reply](/docs/reference/protocol-spec#bulk-strings): the library name that was loaded." - ], - "FUNCTION RESTORE": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "FUNCTION STATS": [ - "[Map reply](/docs/reference/protocol-spec#maps): information about the function that's currently running and information about the available execution engines." - ], - "GEOADD": [ - "[Integer reply](/docs/reference/protocol-spec#integers): When used without optional arguments, the number of elements added to the sorted set (excluding score updates). If the CH option is specified, the number of elements that were changed (added or updated)." - ], - "GEODIST": [ - "One of the following:", - "* [Null reply](/docs/reference/protocol-spec#nulls): one or both of the elements are missing.", - "* [Bulk string reply](/docs/reference/protocol-spec#bulk-strings): distance as a double (represented as a string) in the specified units." - ], - "GEOHASH": [ - "[Array reply](/docs/reference/protocol-spec#arrays): An array where each element is the Geohash corresponding to each member name passed as an argument to the command." - ], - "GEOPOS": [ - "[Array reply](/docs/reference/protocol-spec#arrays): An array where each element is a two elements array representing longitude and latitude (x,y) of each member name passed as argument to the command. Non-existing elements are reported as [Null reply](/docs/reference/protocol-spec#nulls) elements of the array." - ], - "GEORADIUS": [ - "One of the following:", - "* If no `WITH*` option is specified, an [Array reply](/docs/reference/protocol-spec#arrays) of matched member names", - "* If `WITHCOORD`, `WITHDIST`, or `WITHHASH` options are specified, the command returns an [Array reply](/docs/reference/protocol-spec#arrays) of arrays, where each sub-array represents a single item:", - " 1. The distance from the center as a floating point number, in the same unit specified in the radius.", - " 1. The Geohash integer.", - " 1. The coordinates as a two items x,y array (longitude,latitude).", - "", - "For example, the command `GEORADIUS Sicily 15 37 200 km WITHCOORD WITHDIST` will return each item in the following way:", - "", - "`[\"Palermo\",\"190.4424\",[\"13.361389338970184\",\"38.115556395496299\"]]`" - ], - "GEORADIUSBYMEMBER": [ - "One of the following:", - "* If no `WITH*` option is specified, an [Array reply](/docs/reference/protocol-spec#arrays) of matched member names", - "* If `WITHCOORD`, `WITHDIST`, or `WITHHASH` options are specified, the command returns an [Array reply](/docs/reference/protocol-spec#arrays) of arrays, where each sub-array represents a single item:", - " * The distance from the center as a floating point number, in the same unit specified in the radius.", - " * The Geohash integer.", - " * The coordinates as a two items x,y array (longitude,latitude)." - ], - "GEORADIUSBYMEMBER_RO": [ - "One of the following:", - "* If no `WITH*` option is specified, an [Array reply](/docs/reference/protocol-spec#arrays) of matched member names", - "* If `WITHCOORD`, `WITHDIST`, or `WITHHASH` options are specified, the command returns an [Array reply](/docs/reference/protocol-spec#arrays) of arrays, where each sub-array represents a single item:", - " * The distance from the center as a floating point number, in the same unit specified in the radius.", - " * The Geohash integer.", - " * The coordinates as a two items x,y array (longitude,latitude)." - ], - "GEORADIUS_RO": [ - "One of the following:", - "* If no `WITH*` option is specified, an [Array reply](/docs/reference/protocol-spec#arrays) of matched member names", - "* If `WITHCOORD`, `WITHDIST`, or `WITHHASH` options are specified, the command returns an [Array reply](/docs/reference/protocol-spec#arrays) of arrays, where each sub-array represents a single item:", - " * The distance from the center as a floating point number, in the same unit specified in the radius.", - " * The Geohash integer.", - " * The coordinates as a two items x,y array (longitude,latitude)." - ], - "GEOSEARCH": [ - "One of the following:", - "* If no `WITH*` option is specified, an [Array reply](/docs/reference/protocol-spec#arrays) of matched member names", - "* If `WITHCOORD`, `WITHDIST`, or `WITHHASH` options are specified, the command returns an [Array reply](/docs/reference/protocol-spec#arrays) of arrays, where each sub-array represents a single item:", - " * The distance from the center as a floating point number, in the same unit specified in the radius.", - " * The Geohash integer.", - " * The coordinates as a two items x,y array (longitude,latitude)." - ], - "GEOSEARCHSTORE": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of elements in the resulting set" - ], - "GET": [ - "One of the following:", - "* [Bulk string reply](/docs/reference/protocol-spec#bulk-strings): the value of the key.", - "* [Null reply](/docs/reference/protocol-spec#nulls): key does not exist." - ], - "GETBIT": [ - "The bit value stored at _offset_, one of the following:", - "* [Integer reply](/docs/reference/protocol-spec#integers): `0`.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `1`." - ], - "GETDEL": [ - "One of the following:", - "* [Bulk string reply](/docs/reference/protocol-spec#bulk-strings): the value of the key.", - "* [Null reply](/docs/reference/protocol-spec#nulls): if the key does not exist or if the key's value type is not a string." - ], - "GETEX": [ - "[Bulk string reply](/docs/reference/protocol-spec#bulk-strings): the value of `key`", - "[Null reply](/docs/reference/protocol-spec#nulls): if `key` does not exist." - ], - "GETRANGE": [ - "[Bulk string reply](/docs/reference/protocol-spec#bulk-strings): The substring of the string value stored at key, determined by the offsets start and end (both are inclusive)." - ], - "GETSET": [ - "One of the following:", - "* [Bulk string reply](/docs/reference/protocol-spec#bulk-strings): the old value stored at the key.", - "* [Null reply](/docs/reference/protocol-spec#nulls): if the key does not exist." - ], - "HDEL": [ - "[Integer reply](/docs/reference/protocol-spec#integers): The number of fields that were removed from the hash, excluding any specified but non-existing fields." - ], - "HELLO": [ - "[Map reply](/docs/reference/protocol-spec#maps): a list of server properties.", - "[Simple error reply](/docs/reference/protocol-spec#simple-errors): if the `protover` requested does not exist." - ], - "HEXISTS": [ - "One of the following:", - "* [Integer reply](/docs/reference/protocol-spec#integers): `0` if the hash does not contain the field, or the key does not exist.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `1` if the hash contains the field." - ], - "HGET": [ - "One of the following:", - "* [Bulk string reply](/docs/reference/protocol-spec#bulk-strings): The value associated with the field.", - "* [Null reply](/docs/reference/protocol-spec#nulls): If the field is not present in the hash or key does not exist." - ], - "HGETALL": [ - "[Map reply](/docs/reference/protocol-spec#maps): a map of fields and their values stored in the hash, or an empty list when key does not exist." - ], - "HINCRBY": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the value of the field after the increment operation." - ], - "HINCRBYFLOAT": [ - "[Bulk string reply](/docs/reference/protocol-spec#bulk-strings): The value of the field after the increment operation." - ], - "HKEYS": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of fields in the hash, or an empty list when the key does not exist." - ], - "HLEN": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of the fields in the hash, or 0 when the key does not exist." - ], - "HMGET": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of values associated with the given fields, in the same order as they are requested." - ], - "HMSET": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "HRANDFIELD": [ - "Any of the following:", - "* [Null reply](/docs/reference/protocol-spec#nulls): if the key doesn't exist", - "* [Bulk string reply](/docs/reference/protocol-spec#bulk-strings): a single, randomly selected field when the `count` option is not used", - "* [Array reply](/docs/reference/protocol-spec#arrays): a list containing `count` fields when the `count` option is used, or an empty array if the key does not exists.", - "* [Array reply](/docs/reference/protocol-spec#arrays): a list of fields and their values when `count` and `WITHVALUES` were both used." - ], - "HSCAN": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a two-element array.", - "* The first element is a [Bulk string reply](/docs/reference/protocol-spec#bulk-strings) that represents an unsigned 64-bit number, the cursor.", - "* The second element is an [Array reply](/docs/reference/protocol-spec#arrays) of field/value pairs that were scanned." - ], - "HSET": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of fields that were added." - ], - "HSETNX": [ - "One of the following:", - "* [Integer reply](/docs/reference/protocol-spec#integers): `0` if the field already exists in the hash and no operation was performed.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `1` if the field is a new field in the hash and the value was set." - ], - "HSTRLEN": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the string length of the value associated with the _field_, or zero when the _field_ isn't present in the hash or the _key_ doesn't exist at all." - ], - "HVALS": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of values in the hash, or an empty list when the key does not exist." - ], - "INCR": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the value of the key after the increment." - ], - "INCRBY": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the value of the key after the increment." - ], - "INCRBYFLOAT": [ - "[Bulk string reply](/docs/reference/protocol-spec#bulk-strings): the value of the key after the increment." - ], - "INFO": [ - "[Bulk string reply](/docs/reference/protocol-spec#bulk-strings): a map of info fields, one field per line in the form of `:` where the value can be a comma separated map like `=`. Also contains section header lines starting with `#` and blank lines.", - "", - "Lines can contain a section name (starting with a `#` character) or a property. All the properties are in the form of `field:value` terminated by `\\r\\n`." - ], - "KEYS": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of keys matching _pattern_." - ], - "LASTSAVE": [ - "[Integer reply](/docs/reference/protocol-spec#integers): UNIX TIME of the last DB save executed with success." - ], - "LATENCY": [], - "LATENCY DOCTOR": [ - "[Verbatim string reply](/docs/reference/protocol-spec#verbatim-strings): a human readable latency analysis report." - ], - "LATENCY GRAPH": [ - "[Bulk string reply](/docs/reference/protocol-spec#bulk-strings): Latency graph" - ], - "LATENCY HELP": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of sub-commands and their descriptions." - ], - "LATENCY HISTOGRAM": [ - "[Map reply](/docs/reference/protocol-spec#maps): a map where each key is a command name, and each value is a map with the total calls, and an inner map of the histogram time buckets." - ], - "LATENCY HISTORY": [ - "[Array reply](/docs/reference/protocol-spec#arrays): an array where each element is a two elements array representing the timestamp and the latency of the event." - ], - "LATENCY LATEST": [ - "[Array reply](/docs/reference/protocol-spec#arrays): an array where each element is a four elements array representing the event's name, timestamp, latest and all-time latency measurements." - ], - "LATENCY RESET": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of event time series that were reset." - ], - "LCS": [ - "One of the following:", - "* [Bulk string reply](/docs/reference/protocol-spec#bulk-strings): the longest common subsequence.", - "* [Integer reply](/docs/reference/protocol-spec#integers): the length of the longest common subsequence when _LEN_ is given.", - "* [Map reply](/docs/reference/protocol-spec#maps): a map with the LCS length and all the ranges in both the strings when _IDX_ is given." - ], - "LINDEX": [ - "One of the following:", - "* [Null reply](/docs/reference/protocol-spec#nulls): when _index_ is out of range.", - "* [Bulk string reply](/docs/reference/protocol-spec#bulk-strings): the requested element." - ], - "LINSERT": [ - "One of the following:", - "* [Integer reply](/docs/reference/protocol-spec#integers): the list length after a successful insert operation.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `0` when the key doesn't exist.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `-1` when the pivot wasn't found." - ], - "LLEN": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the length of the list." - ], - "LMOVE": [ - "[Bulk string reply](/docs/reference/protocol-spec#bulk-strings): the element being popped and pushed." - ], - "LMPOP": [ - "One of the following:", - "* [Null reply](/docs/reference/protocol-spec#nulls): if no element could be popped.", - "* [Array reply](/docs/reference/protocol-spec#arrays): a two-element array with the first element being the name of the key from which elements were popped and the second element being an array of elements." - ], - "LOLWUT": [ - "[Verbatim string reply](/docs/reference/protocol-spec#verbatim-strings): a string containing generative computer art and the Redis version." - ], - "LPOP": [ - "One of the following:", - "* [Null reply](/docs/reference/protocol-spec#nulls): if the key does not exist.", - "* [Bulk string reply](/docs/reference/protocol-spec#bulk-strings): when called without the _count_ argument, the value of the first element.", - "* [Array reply](/docs/reference/protocol-spec#arrays): when called with the _count_ argument, a list of popped elements." - ], - "LPOS": [ - "Any of the following:", - "* [Null reply](/docs/reference/protocol-spec#nulls): if there is no matching element.", - "* [Integer reply](/docs/reference/protocol-spec#integers): an integer representing the matching element.", - "* [Array reply](/docs/reference/protocol-spec#arrays): If the COUNT option is given, an array of integers representing the matching elements (or an empty array if there are no matches)." - ], - "LPUSH": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the length of the list after the push operation." - ], - "LPUSHX": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the length of the list after the push operation." - ], - "LRANGE": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of elements in the specified range, or an empty array if the key doesn't exist." - ], - "LREM": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of removed elements." - ], - "LSET": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "LTRIM": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "MEMORY": [], - "MEMORY DOCTOR": [ - "[Verbatim string reply](/docs/reference/protocol-spec#verbatim-strings): a memory problems report." - ], - "MEMORY HELP": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of sub-commands and their descriptions." - ], - "MEMORY MALLOC-STATS": [ - "[Bulk string reply](/docs/reference/protocol-spec#bulk-strings): The memory allocator's internal statistics report." - ], - "MEMORY PURGE": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "MEMORY STATS": [ - "[Map reply](/docs/reference/protocol-spec#maps): memory usage metrics and their values." - ], - "MEMORY USAGE": [ - "One of the following:", - "* [Integer reply](/docs/reference/protocol-spec#integers): the memory usage in bytes.", - "* [Null reply](/docs/reference/protocol-spec#nulls): if the key does not exist." - ], - "MGET": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of values at the specified keys." - ], - "MIGRATE": [ - "One of the following:", - "* [Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` on success.", - "* [Simple string reply](/docs/reference/protocol-spec#simple-strings): `NOKEY` when no keys were found in the source instance." - ], - "MODULE": [], - "MODULE HELP": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of sub-commands and their descriptions" - ], - "MODULE LIST": [ - "[Array reply](/docs/reference/protocol-spec#arrays): list of loaded modules. Each element in the list represents a represents a module, and is a [Map reply](/docs/reference/protocol-spec#maps) of property names and their values. The following properties is reported for each loaded module:", - "* name: the name of the module.", - "* ver: the version of the module." - ], - "MODULE LOAD": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` if the module was loaded." - ], - "MODULE LOADEX": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` if the module was loaded." - ], - "MODULE UNLOAD": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` if the module was unloaded." - ], - "MONITOR": [ - "**Non-standard return value**. Dumps the received commands in an infinite flow." - ], - "MOVE": [ - "One of the following:", - "* [Integer reply](/docs/reference/protocol-spec#integers): `1` if _key_ was moved.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `0` if _key_ wasn't moved." - ], - "MSET": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): always `OK` because `MSET` can't fail." - ], - "MSETNX": [ - "One of the following:", - "* [Integer reply](/docs/reference/protocol-spec#integers): `0` if no key was set (at least one key already existed).", - "* [Integer reply](/docs/reference/protocol-spec#integers): `1` if all the keys were set." - ], - "MULTI": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "OBJECT": [], - "OBJECT ENCODING": [ - "One of the following:", - "* [Null reply](/docs/reference/protocol-spec#nulls): if the key doesn't exist.", - "* [Bulk string reply](/docs/reference/protocol-spec#bulk-strings): the encoding of the object." - ], - "OBJECT FREQ": [ - "One of the following:", - "[Integer reply](/docs/reference/protocol-spec#integers): the counter's value.", - "[Null reply](/docs/reference/protocol-spec#nulls): if _key_ doesn't exist." - ], - "OBJECT HELP": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of sub-commands and their descriptions." - ], - "OBJECT IDLETIME": [ - "One of the following:", - "[Integer reply](/docs/reference/protocol-spec#integers): the idle time in seconds.", - "[Null reply](/docs/reference/protocol-spec#nulls): if _key_ doesn't exist." - ], - "OBJECT REFCOUNT": [ - "One of the following:", - "[Integer reply](/docs/reference/protocol-spec#integers): the number of references.", - "[Null reply](/docs/reference/protocol-spec#nulls): if _key_ doesn't exist." - ], - "PERSIST": [ - "One of the following:", - "* [Integer reply](/docs/reference/protocol-spec#integers): `0` if _key_ does not exist or does not have an associated timeout.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `1` if the timeout has been removed." - ], - "PEXPIRE": [ - "One of the following:", - "* [Integer reply](/docs/reference/protocol-spec#integers): `0`if the timeout was not set. For example, if the key doesn't exist, or the operation skipped because of the provided arguments.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `1` if the timeout was set." - ], - "PEXPIREAT": [ - "One of the following:", - "* [Integer reply](/docs/reference/protocol-spec#integers): `1` if the timeout was set.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `0` if the timeout was not set. For example, if the key doesn't exist, or the operation was skipped due to the provided arguments." - ], - "PEXPIRETIME": [ - "One of the following:", - "* [Integer reply](/docs/reference/protocol-spec#integers): Expiration Unix timestamp in milliseconds.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `-1` if the key exists but has no associated expiration time.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `-2` if the key does not exist." - ], - "PFADD": [ - "One of the following:", - "* [Integer reply](/docs/reference/protocol-spec#integers): `1` if at least one HyperLogLog internal register was altered.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `0` if no HyperLogLog internal registers were altered." - ], - "PFCOUNT": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the approximated number of unique elements observed via `PFADD`" - ], - "PFDEBUG": [], - "PFMERGE": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "PFSELFTEST": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "PING": [ - "Any of the following:", - "* [Simple string reply](/docs/reference/protocol-spec#simple-strings): `PONG` when no argument is provided.", - "* [Bulk string reply](/docs/reference/protocol-spec#bulk-strings): the provided argument." - ], - "PSETEX": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "PSUBSCRIBE": [ - "When successful, this command doesn't return anything. Instead, for each pattern, one message with the first element being the string `psubscribe` is pushed as a confirmation that the command succeeded." - ], - "PSYNC": [ - "**Non-standard return value**, a bulk transfer of the data followed by `PING` and write requests from the master." - ], - "PTTL": [ - "One of the following:", - "* [Integer reply](/docs/reference/protocol-spec#integers): TTL in milliseconds.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `-1` if the key exists but has no associated expiration.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `-2` if the key does not exist." - ], - "PUBLISH": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of clients that received the message. Note that in a Redis Cluster, only clients that are connected to the same node as the publishing client are included in the count." - ], - "PUBSUB": [], - "PUBSUB CHANNELS": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of active channels, optionally matching the specified pattern." - ], - "PUBSUB HELP": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of sub-commands and their descriptions." - ], - "PUBSUB NUMPAT": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of patterns all the clients are subscribed to." - ], - "PUBSUB NUMSUB": [ - "[Array reply](/docs/reference/protocol-spec#arrays): the number of subscribers per channel, each even element (including the 0th) is channel name, each odd element is the number of subscribers" - ], - "PUBSUB SHARDCHANNELS": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of active channels, optionally matching the specified pattern." - ], - "PUBSUB SHARDNUMSUB": [ - "[Array reply](/docs/reference/protocol-spec#arrays): the number of subscribers per shard channel, each even element (including the 0th) is channel name, each odd element is the number of subscribers." - ], - "PUNSUBSCRIBE": [ - "When successful, this command doesn't return anything. Instead, for each pattern, one message with the first element being the string `punsubscribe` is pushed as a confirmation that the command succeeded." - ], - "QUIT": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "RANDOMKEY": [ - "One of the following:", - "* [Null reply](/docs/reference/protocol-spec#nulls): when the database is empty.", - "* [Bulk string reply](/docs/reference/protocol-spec#bulk-strings): a random key in the database." - ], - "READONLY": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "READWRITE": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "RENAME": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "RENAMENX": [ - "One of the following:", - "* [Integer reply](/docs/reference/protocol-spec#integers): `1` if _key_ was renamed to _newkey_.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `0` if _newkey_ already exists." - ], - "REPLCONF": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "REPLICAOF": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "RESET": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `RESET`." - ], - "RESTORE": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "RESTORE-ASKING": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "ROLE": [ - "[Array reply](/docs/reference/protocol-spec#arrays): where the first element is one of `master`, `slave`, or `sentinel`, and the additional elements are role-specific as illustrated above." - ], - "RPOP": [ - "One of the following:", - "* [Null reply](/docs/reference/protocol-spec#nulls): if the key does not exist.", - "* [Bulk string reply](/docs/reference/protocol-spec#bulk-strings): when called without the _count_ argument, the value of the last element.", - "* [Array reply](/docs/reference/protocol-spec#arrays): when called with the _count_ argument, a list of popped elements." - ], - "RPOPLPUSH": [ - "One of the following:", - "* [Bulk string reply](/docs/reference/protocol-spec#bulk-strings): the element being popped and pushed.", - "* [Null reply](/docs/reference/protocol-spec#nulls): if the source list is empty." - ], - "RPUSH": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the length of the list after the push operation." - ], - "RPUSHX": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the length of the list after the push operation." - ], - "SADD": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of elements that were added to the set, not including all the elements already present in the set." - ], - "SAVE": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "SCAN": [ - "[Array reply](/docs/reference/protocol-spec#arrays): specifically, an array with two elements.", - "* The first element is a [Bulk string reply](/docs/reference/protocol-spec#bulk-strings) that represents an unsigned 64-bit number, the cursor.", - "* The second element is an [Array reply](/docs/reference/protocol-spec#arrays) with the names of scanned keys." - ], - "SCARD": [ - "[Integer reply](/docs/reference/protocol-spec#integers): The cardinality (number of elements) of the set, or 0 if the key does not exist." - ], - "SCRIPT": [], - "SCRIPT DEBUG": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "SCRIPT EXISTS": [ - "[Array reply](/docs/reference/protocol-spec#arrays): an array of integers that correspond to the specified SHA1 digest arguments." - ], - "SCRIPT FLUSH": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "SCRIPT HELP": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of sub-commands and their descriptions." - ], - "SCRIPT KILL": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "SCRIPT LOAD": [ - "[Bulk string reply](/docs/reference/protocol-spec#bulk-strings): the SHA1 digest of the script added into the script cache." - ], - "SDIFF": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list with the members of the resulting set." - ], - "SDIFFSTORE": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of elements in the resulting set." - ], - "SELECT": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "SENTINEL CKQUORUM": [ - "[Bulk string reply](/docs/reference/protocol-spec#bulk-strings): Returns OK if the current Sentinel configuration is able to reach the quorum needed to failover a master, and the majority needed to authorize the failover." - ], - "SENTINEL CONFIG": [ - "One of the following:", - "* [Map reply](/docs/reference/protocol-spec#maps): When 'SENTINEL-CONFIG GET' is called, returns a map.", - "* [Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`. When 'SENTINEL-CONFIG SET' is called, returns OK on success." - ], - "SENTINEL DEBUG": [ - "One of the following:", - "* [Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`. The configuration update was successful.", - "* [Map reply](/docs/reference/protocol-spec#maps): List of configurable time parameters and their values (milliseconds)." - ], - "SENTINEL FAILOVER": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`. Force a fail over as if the master was not reachable, and without asking for agreement to other Sentinels." - ], - "SENTINEL FLUSHCONFIG": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`. Force Sentinel to rewrite its configuration on disk, including the current Sentinel state." - ], - "SENTINEL GET MASTER-ADDR-BY-NAME": [], - "SENTINEL HELP": [ - "[Array reply](/docs/reference/protocol-spec#arrays): Helpful text about subcommands." - ], - "SENTINEL INFO CACHE": [ - "[Array reply](/docs/reference/protocol-spec#arrays): This is actually a map, the odd entries are a master name, and the even entries are the last cached INFO output from that master and all its replicas." - ], - "SENTINEL IS MASTER-DOWN-BY-ADDR": [], - "SENTINEL MASTER": [ - "[Map reply](/docs/reference/protocol-spec#maps): The state and info of the specified master." - ], - "SENTINEL MASTERS": [ - "[Array reply](/docs/reference/protocol-spec#arrays): List of monitored Redis masters, and their state." - ], - "SENTINEL MONITOR": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "SENTINEL MYID": [ - "[Bulk string reply](/docs/reference/protocol-spec#bulk-strings): Node ID of the sentinel instance." - ], - "SENTINEL PENDING SCRIPTS": [ - "[Array reply](/docs/reference/protocol-spec#arrays): List of pending scripts." - ], - "SENTINEL REMOVE": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "SENTINEL REPLICAS": [ - "[Array reply](/docs/reference/protocol-spec#arrays): List of replicas for this master, and their state." - ], - "SENTINEL RESET": [ - "[Integer reply](/docs/reference/protocol-spec#integers): The number of masters that were reset." - ], - "SENTINEL SENTINELS": [ - "[Array reply](/docs/reference/protocol-spec#arrays): List of sentinel instances, and their state." - ], - "SENTINEL SET": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "SENTINEL SIMULATE FAILURE": [ - "One of the following:", - "* [Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`. The simulated flag was set.", - "* [Array reply](/docs/reference/protocol-spec#arrays): Supported simulates flags. Returned in case `HELP` was used." - ], - "SENTINEL SLAVES": [ - "[Array reply](/docs/reference/protocol-spec#arrays): List of monitored replicas, and their state." - ], - "SET": [ - "Any of the following:", - "* [Null reply](/docs/reference/protocol-spec#nulls): `GET` not given: Operation was aborted (conflict with one of the `XX`/`NX` options).", - "* [Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`. `GET` not given: The key was set.", - "* [Null reply](/docs/reference/protocol-spec#nulls): `GET` given: The key didn't exist before the `SET`.", - "* [Bulk string reply](/docs/reference/protocol-spec#bulk-strings): `GET` given: The previous value of the key." - ], - "SETBIT": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the original bit value stored at _offset_." - ], - "SETEX": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "SETNX": [ - "One of the following:", - "* [Integer reply](/docs/reference/protocol-spec#integers): `0` if the key was not set.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `1` if the key was set." - ], - "SETRANGE": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the length of the string after it was modified by the command." - ], - "SHUTDOWN": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK` if _ABORT_ was specified and shutdown was aborted. On successful shutdown, nothing is returned because the server quits and the connection is closed. On failure, an error is returned." - ], - "SINTER": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list with the members of the resulting set." - ], - "SINTERCARD": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of the elements in the resulting intersection." - ], - "SINTERSTORE": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of the elements in the result set." - ], - "SISMEMBER": [ - "One of the following:", - "* [Integer reply](/docs/reference/protocol-spec#integers): `0` if the element is not a member of the set, or when the key does not exist.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `1` if the element is a member of the set." - ], - "SLAVEOF": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "SLOWLOG": [], - "SLOWLOG GET": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of slow log entries per the above format." - ], - "SLOWLOG HELP": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of sub-commands and their descriptions." - ], - "SLOWLOG LEN": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of entries in the slow log." - ], - "SLOWLOG RESET": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "SMEMBERS": [ - "[Array reply](/docs/reference/protocol-spec#arrays): all members of the set." - ], - "SMISMEMBER": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list representing the membership of the given elements, in the same order as they are requested." - ], - "SMOVE": [ - "One of the following:", - "* [Integer reply](/docs/reference/protocol-spec#integers): `1` if the element is moved.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `0` if the element is not a member of _source_ and no operation was performed." - ], - "SORT": [ - "[Array reply](/docs/reference/protocol-spec#arrays): without passing the _STORE_ option, the command returns a list of sorted elements.", - "[Integer reply](/docs/reference/protocol-spec#integers): when the _STORE_ option is specified, the command returns the number of sorted elements in the destination list." - ], - "SORT_RO": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of sorted elements." - ], - "SPOP": [ - "One of the following:", - "* [Null reply](/docs/reference/protocol-spec#nulls): if the key does not exist.", - "* [Bulk string reply](/docs/reference/protocol-spec#bulk-strings): when called without the _count_ argument, the removed member.", - "* [Array reply](/docs/reference/protocol-spec#arrays): when called with the _count_ argument, a list of the removed members." - ], - "SPUBLISH": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of clients that received the message. Note that in a Redis Cluster, only clients that are connected to the same node as the publishing client are included in the count" - ], - "SRANDMEMBER": [ - "One of the following:", - "* [Bulk string reply](/docs/reference/protocol-spec#bulk-strings): without the additional _count_ argument, the command returns a randomly selected member, or a [Null reply](/docs/reference/protocol-spec#nulls) when _key_ doesn't exist.", - "* [Array reply](/docs/reference/protocol-spec#arrays): when the optional _count_ argument is passed, the command returns an array of members, or an empty array when _key_ doesn't exist." - ], - "SREM": [ - "[Integer reply](/docs/reference/protocol-spec#integers): Number of members that were removed from the set, not including non existing members." - ], - "SSCAN": [ - "[Array reply](/docs/reference/protocol-spec#arrays): specifically, an array with two elements:", - "* The first element is a [Bulk string reply](/docs/reference/protocol-spec#bulk-strings) that represents an unsigned 64-bit number, the cursor.", - "* The second element is an [Array reply](/docs/reference/protocol-spec#arrays) with the names of scanned members." - ], - "SSUBSCRIBE": [ - "When successful, this command doesn't return anything. Instead, for each shard channel, one message with the first element being the string 'ssubscribe' is pushed as a confirmation that the command succeeded. Note that this command can also return a -MOVED redirect." - ], - "STRLEN": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the length of the string stored at key, or 0 when the key does not exist." - ], - "SUBSCRIBE": [ - "When successful, this command doesn't return anything. Instead, for each channel, one message with the first element being the string `subscribe` is pushed as a confirmation that the command succeeded." - ], - "SUBSTR": [ - "[Bulk string reply](/docs/reference/protocol-spec#bulk-strings): the substring of the string value stored at key, determined by the offsets start and end (both are inclusive)." - ], - "SUNION": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list with the members of the resulting set." - ], - "SUNIONSTORE": [ - "[Integer reply](/docs/reference/protocol-spec#integers): Number of the elements in the resulting set." - ], - "SUNSUBSCRIBE": [ - "When successful, this command doesn't return anything. Instead, for each shard channel, one message with the first element being the string `sunsubscribe` is pushed as a confirmation that the command succeeded." - ], - "SWAPDB": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "SYNC": [ - "**Non-standard return value**, a bulk transfer of the data followed by `PING` and write requests from the master." - ], - "TIME": [ - "[Array reply](/docs/reference/protocol-spec#arrays): specifically, a two-element array consisting of the Unix timestamp in seconds and the microseconds' count." - ], - "TOUCH": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of touched keys." - ], - "TTL": [ - "One of the following:", - "* [Integer reply](/docs/reference/protocol-spec#integers): TTL in seconds.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `-1` if the key exists but has no associated expiration.", - "* [Integer reply](/docs/reference/protocol-spec#integers): `-2` if the key does not exist." - ], - "TYPE": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): the type of _key_, or `none` when _key_ doesn't exist." - ], - "UNLINK": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of keys that were unlinked." - ], - "UNSUBSCRIBE": [ - "When successful, this command doesn't return anything. Instead, for each channel, one message with the first element being the string `unsubscribe` is pushed as a confirmation that the command succeeded." - ], - "UNWATCH": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "WAIT": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of replicas reached by all the writes performed in the context of the current connection." - ], - "WAITAOF": [ - "[Array reply](/docs/reference/protocol-spec#arrays): The command returns an array of two integers:", - "1. The first is the number of local Redises (0 or 1) that have fsynced to AOF all writes performed in the context of the current connection", - "2. The second is the number of replicas that have acknowledged doing the same." - ], - "WATCH": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "XACK": [ - "[Integer reply](/docs/reference/protocol-spec#integers): The command returns the number of messages successfully acknowledged. Certain message IDs may no longer be part of the PEL (for example because they have already been acknowledged), and XACK will not count them as successfully acknowledged." - ], - "XADD": [ - "One of the following:", - "* [Bulk string reply](/docs/reference/protocol-spec#bulk-strings): The ID of the added entry. The ID is the one automatically generated if an asterisk (`*`) is passed as the _id_ argument, otherwise the command just returns the same ID specified by the user during insertion.", - "* [Null reply](/docs/reference/protocol-spec#nulls): if the NOMKSTREAM option is given and the key doesn't exist." - ], - "XAUTOCLAIM": [ - "[Array reply](/docs/reference/protocol-spec#arrays), specifically, an array with three elements:", - "1. A stream ID to be used as the _start_ argument for the next call to XAUTOCLAIM.", - "2. An [Array reply](/docs/reference/protocol-spec#arrays) containing all the successfully claimed messages in the same format as `XRANGE`.", - "3. An [Array reply](/docs/reference/protocol-spec#arrays) containing message IDs that no longer exist in the stream, and were deleted from the PEL in which they were found." - ], - "XCLAIM": [ - "Any of the following:", - "* [Array reply](/docs/reference/protocol-spec#arrays): when the _JUSTID_ option is specified, an array of IDs of messages successfully claimed.", - "* [Array reply](/docs/reference/protocol-spec#arrays): an array of stream entries, each of which contains an array of two elements, the entry ID and the entry data itself." - ], - "XDEL": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of entries that were deleted." - ], - "XGROUP": [], - "XGROUP CREATE": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "XGROUP CREATECONSUMER": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of created consumers, either 0 or 1." - ], - "XGROUP DELCONSUMER": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of pending messages the consumer had before it was deleted." - ], - "XGROUP DESTROY": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of destroyed consumer groups, either 0 or 1." - ], - "XGROUP HELP": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of sub-commands and their descriptions." - ], - "XGROUP SETID": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "XINFO": [], - "XINFO CONSUMERS": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of consumers and their attributes." - ], - "XINFO GROUPS": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of consumer groups." - ], - "XINFO HELP": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of sub-commands and their descriptions." - ], - "XINFO STREAM": [ - "One of the following:", - "* [Map reply](/docs/reference/protocol-spec#maps): when the _FULL_ argument was not given, a list of information about a stream in summary form.", - "* [Map reply](/docs/reference/protocol-spec#maps): when the _FULL_ argument was given, a list of information about a stream in extended form." - ], - "XLEN": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of entries of the stream at _key_." - ], - "XPENDING": [ - "* [Array reply](/docs/reference/protocol-spec#arrays): different data depending on the way XPENDING is called, as explained on this page." - ], - "XRANGE": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of stream entries with IDs matching the specified range." - ], - "XREAD": [ - "One of the following:", - "* [Map reply](/docs/reference/protocol-spec#maps): A map of key-value elements where each element is composed of the key name and the entries reported for that key. The entries reported are full stream entries, having IDs and the list of all the fields and values. Field and values are guaranteed to be reported in the same order they were added by `XADD`.", - "* [Null reply](/docs/reference/protocol-spec#nulls): if the _BLOCK_ option is given and a timeout occurs, or if there is no stream that can be served." - ], - "XREADGROUP": [ - "One of the following:", - "* [Map reply](/docs/reference/protocol-spec#maps): A map of key-value elements where each element is composed of the key name and the entries reported for that key. The entries reported are full stream entries, having IDs and the list of all the fields and values. Field and values are guaranteed to be reported in the same order they were added by `XADD`.", - "* [Null reply](/docs/reference/protocol-spec#nulls): if the _BLOCK_ option is given and a timeout occurs, or if there is no stream that can be served." - ], - "XREVRANGE": [ - "[Array reply](/docs/reference/protocol-spec#arrays): The command returns the entries with IDs matching the specified range. The returned entries are complete, which means that the ID and all the fields they are composed of are returned. Moreover, the entries are returned with their fields and values in the same order as `XADD` added them." - ], - "XSETID": [ - "[Simple string reply](/docs/reference/protocol-spec#simple-strings): `OK`." - ], - "XTRIM": [ - "[Integer reply](/docs/reference/protocol-spec#integers): The number of entries deleted from the stream." - ], - "ZADD": [ - "Any of the following:", - "* [Null reply](/docs/reference/protocol-spec#nulls): if the operation was aborted because of a conflict with one of the _XX/NX/LT/GT_ options.", - "* [Integer reply](/docs/reference/protocol-spec#integers): the number of new members when the _CH_ option is not used.", - "* [Integer reply](/docs/reference/protocol-spec#integers): the number of new or updated members when the _CH_ option is used.", - "* [Double reply](/docs/reference/protocol-spec#doubles): the updated score of the member when the _INCR_ option is used." - ], - "ZCARD": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the cardinality (number of members) of the sorted set, or 0 if the key doesn't exist." - ], - "ZCOUNT": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of members in the specified score range." - ], - "ZDIFF": [ - "* [Array reply](/docs/reference/protocol-spec#arrays): the result of the difference including, optionally, scores when the _WITHSCORES_ option is used." - ], - "ZDIFFSTORE": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of members in the resulting sorted set at _destination_." - ], - "ZINCRBY": [ - "[Double reply](/docs/reference/protocol-spec#doubles): the new score of _member_." - ], - "ZINTER": [ - "* [Array reply](/docs/reference/protocol-spec#arrays): the result of the intersection including, optionally, scores when the _WITHSCORES_ option is used." - ], - "ZINTERCARD": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of members in the resulting intersection." - ], - "ZINTERSTORE": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of members in the resulting sorted set at the _destination_." - ], - "ZLEXCOUNT": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of members in the specified score range." - ], - "ZMPOP": [ - "One of the following:", - "* [Null reply](/docs/reference/protocol-spec#nulls): when no element could be popped.", - "* [Array reply](/docs/reference/protocol-spec#arrays): A two-element array with the first element being the name of the key from which elements were popped, and the second element is an array of the popped elements. Every entry in the elements array is also an array that contains the member and its score." - ], - "ZMSCORE": [ - "One of the following:", - "* [Null reply](/docs/reference/protocol-spec#nulls): if the member does not exist in the sorted set.", - "* [Array reply](/docs/reference/protocol-spec#arrays): a list of [Double reply](/docs/reference/protocol-spec#doubles) _member_ scores as double-precision floating point numbers." - ], - "ZPOPMAX": [ - "* [Array reply](/docs/reference/protocol-spec#arrays): a list of popped elements and scores." - ], - "ZPOPMIN": [ - "* [Array reply](/docs/reference/protocol-spec#arrays): a list of popped elements and scores." - ], - "ZRANDMEMBER": [ - "[Bulk string reply](/docs/reference/protocol-spec#bulk-strings): without the additional _count_ argument, the command returns a randomly selected member, or [Null reply](/docs/reference/protocol-spec#nulls) when _key_ doesn't exist.", - "[Array reply](/docs/reference/protocol-spec#arrays): when the additional _count_ argument is passed, the command returns an array of members, or an empty array when _key_ doesn't exist. If the _WITHSCORES_ modifier is used, the reply is a list of members and their scores from the sorted set." - ], - "ZRANGE": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of members in the specified range with, optionally, their scores when the _WITHSCORES_ option is given." - ], - "ZRANGEBYLEX": [ - "[Array reply](/docs/reference/protocol-spec#arrays): a list of elements in the specified score range." - ], - "ZRANGEBYSCORE": [ - "* [Array reply](/docs/reference/protocol-spec#arrays): a list of the members with, optionally, their scores in the specified score range." - ], - "ZRANGESTORE": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of elements in the resulting sorted set." - ], - "ZRANK": [ - "One of the following:", - "* [Null reply](/docs/reference/protocol-spec#nulls): if the key does not exist or the member does not exist in the sorted set.", - "* [Integer reply](/docs/reference/protocol-spec#integers): the rank of the member when _WITHSCORE_ is not used.", - "* [Array reply](/docs/reference/protocol-spec#arrays): the rank and score of the member when _WITHSCORE_ is used." - ], - "ZREM": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of members removed from the sorted set, not including non-existing members." - ], - "ZREMRANGEBYLEX": [ - "[Integer reply](/docs/reference/protocol-spec#integers): Number of members removed." - ], - "ZREMRANGEBYRANK": [ - "[Integer reply](/docs/reference/protocol-spec#integers): Number of members removed." - ], - "ZREMRANGEBYSCORE": [ - "[Integer reply](/docs/reference/protocol-spec#integers): Number of members removed." - ], - "ZREVRANGE": [ - "* [Array reply](/docs/reference/protocol-spec#arrays): a list of members in the specified range, optionally with their scores if _WITHSCORE_ was used." - ], - "ZREVRANGEBYLEX": [ - "[Array reply](/docs/reference/protocol-spec#arrays): List of the elements in the specified score range." - ], - "ZREVRANGEBYSCORE": [ - "* [Array reply](/docs/reference/protocol-spec#arrays): a list of the members and, optionally, their scores in the specified score range." - ], - "ZREVRANK": [ - "One of the following:", - "* [Null reply](/docs/reference/protocol-spec#nulls): if the key does not exist or the member does not exist in the sorted set.", - "* [Integer reply](/docs/reference/protocol-spec#integers): The rank of the member when _WITHSCORE_ is not used.", - "* [Array reply](/docs/reference/protocol-spec#arrays): The rank and score of the member when _WITHSCORE_ is used." - ], - "ZSCAN": [ - "[Array reply](/docs/reference/protocol-spec#arrays): cursor and scan response in array form." - ], - "ZSCORE": [ - "One of the following:", - "* [Double reply](/docs/reference/protocol-spec#doubles): the score of the member (a double-precision floating point number).", - "* [Nil reply](/docs/reference/protocol-spec#bulk-strings): if _member_ does not exist in the sorted set, or the key does not exist." - ], - "ZUNION": [ - "[Array reply](/docs/reference/protocol-spec#arrays): the result of the union with, optionally, their scores when _WITHSCORES_ is used." - ], - "ZUNIONSTORE": [ - "[Integer reply](/docs/reference/protocol-spec#integers): the number of elements in the resulting sorted set." - ] - } - \ No newline at end of file diff --git a/Sources/RedisCommands/BitmapCommands.swift b/Sources/Valkey/Commands/BitmapCommands.swift similarity index 65% rename from Sources/RedisCommands/BitmapCommands.swift rename to Sources/Valkey/Commands/BitmapCommands.swift index 88f724d1..85a20d0a 100644 --- a/Sources/RedisCommands/BitmapCommands.swift +++ b/Sources/Valkey/Commands/BitmapCommands.swift @@ -1,21 +1,20 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -// This file is autogenerated by RedisCommandsBuilder +// This file is autogenerated by ValkeyCommandsBuilder import NIOCore -import Redis #if canImport(FoundationEssentials) import FoundationEssentials @@ -24,13 +23,13 @@ import Foundation #endif /// Counts the number of set bits (population counting) in a string. -public struct BITCOUNT: RedisCommand { +public struct BITCOUNT: RESPCommand { public enum RangeUnit: RESPRenderable { case byte case bit @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .byte: "BYTE".encode(into: &commandEncoder) case .bit: "BIT".encode(into: &commandEncoder) @@ -43,7 +42,7 @@ public struct BITCOUNT: RedisCommand { @usableFromInline let unit: RangeUnit? @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += start.encode(into: &commandEncoder) count += end.encode(into: &commandEncoder) @@ -53,27 +52,27 @@ public struct BITCOUNT: RedisCommand { } public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var range: Range? = nil - @inlinable public init(key: RedisKey, range: Range? = nil) { + @inlinable public init(key: RESPKey, range: Range? = nil) { self.key = key self.range = range } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("BITCOUNT", key, range) } } /// Performs arbitrary bitfield integer operations on strings. -public struct BITFIELD: RedisCommand { +public struct BITFIELD: RESPCommand { public struct OperationGetBlock: RESPRenderable { @usableFromInline let encoding: String @usableFromInline let offset: Int @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += encoding.encode(into: &commandEncoder) count += offset.encode(into: &commandEncoder) @@ -86,7 +85,7 @@ public struct BITFIELD: RedisCommand { case fail @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .wrap: "WRAP".encode(into: &commandEncoder) case .sat: "SAT".encode(into: &commandEncoder) @@ -100,7 +99,7 @@ public struct BITFIELD: RedisCommand { @usableFromInline let value: Int @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += encoding.encode(into: &commandEncoder) count += offset.encode(into: &commandEncoder) @@ -114,7 +113,7 @@ public struct BITFIELD: RedisCommand { @usableFromInline let increment: Int @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += encoding.encode(into: &commandEncoder) count += offset.encode(into: &commandEncoder) @@ -127,7 +126,7 @@ public struct BITFIELD: RedisCommand { case incrbyBlock(OperationWriteWriteOperationIncrbyBlock) @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .setBlock(let setBlock): RESPWithToken("SET", setBlock).encode(into: &commandEncoder) case .incrbyBlock(let incrbyBlock): RESPWithToken("INCRBY", incrbyBlock).encode(into: &commandEncoder) @@ -139,7 +138,7 @@ public struct BITFIELD: RedisCommand { @usableFromInline let writeOperation: OperationWriteWriteOperation @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += RESPWithToken("OVERFLOW", overflowBlock).encode(into: &commandEncoder) count += writeOperation.encode(into: &commandEncoder) @@ -151,7 +150,7 @@ public struct BITFIELD: RedisCommand { case write(OperationWrite) @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .getBlock(let getBlock): RESPWithToken("GET", getBlock).encode(into: &commandEncoder) case .write(let write): write.encode(into: &commandEncoder) @@ -160,27 +159,27 @@ public struct BITFIELD: RedisCommand { } public typealias Response = [RESPToken]? - public var key: RedisKey + public var key: RESPKey public var operation: [Operation] = [] - @inlinable public init(key: RedisKey, operation: [Operation] = []) { + @inlinable public init(key: RESPKey, operation: [Operation] = []) { self.key = key self.operation = operation } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("BITFIELD", key, operation) } } /// Performs arbitrary read-only bitfield integer operations on strings. -public struct BITFIELDRO: RedisCommand { +public struct BITFIELDRO: RESPCommand { public struct GetBlock: RESPRenderable { @usableFromInline let encoding: String @usableFromInline let offset: Int @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += encoding.encode(into: &commandEncoder) count += offset.encode(into: &commandEncoder) @@ -189,21 +188,21 @@ public struct BITFIELDRO: RedisCommand { } public typealias Response = [RESPToken] - public var key: RedisKey + public var key: RESPKey public var getBlock: [GetBlock] = [] - @inlinable public init(key: RedisKey, getBlock: [GetBlock] = []) { + @inlinable public init(key: RESPKey, getBlock: [GetBlock] = []) { self.key = key self.getBlock = getBlock } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("BITFIELD_RO", key, RESPWithToken("GET", getBlock)) } } /// Performs bitwise operations on multiple strings, and stores the result. -public struct BITOP: RedisCommand { +public struct BITOP: RESPCommand { public enum Operation: RESPRenderable { case and case or @@ -211,7 +210,7 @@ public struct BITOP: RedisCommand { case not @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .and: "AND".encode(into: &commandEncoder) case .or: "OR".encode(into: &commandEncoder) @@ -223,28 +222,28 @@ public struct BITOP: RedisCommand { public typealias Response = Int public var operation: Operation - public var destkey: RedisKey - public var key: [RedisKey] + public var destkey: RESPKey + public var key: [RESPKey] - @inlinable public init(operation: Operation, destkey: RedisKey, key: [RedisKey]) { + @inlinable public init(operation: Operation, destkey: RESPKey, key: [RESPKey]) { self.operation = operation self.destkey = destkey self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("BITOP", operation, destkey, key) } } /// Finds the first set (1) or clear (0) bit in a string. -public struct BITPOS: RedisCommand { +public struct BITPOS: RESPCommand { public enum RangeEndUnitBlockUnit: RESPRenderable { case byte case bit @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .byte: "BYTE".encode(into: &commandEncoder) case .bit: "BIT".encode(into: &commandEncoder) @@ -256,7 +255,7 @@ public struct BITPOS: RedisCommand { @usableFromInline let unit: RangeEndUnitBlockUnit? @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += end.encode(into: &commandEncoder) count += unit.encode(into: &commandEncoder) @@ -268,7 +267,7 @@ public struct BITPOS: RedisCommand { @usableFromInline let endUnitBlock: RangeEndUnitBlock? @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += start.encode(into: &commandEncoder) count += endUnitBlock.encode(into: &commandEncoder) @@ -277,118 +276,118 @@ public struct BITPOS: RedisCommand { } public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var bit: Int public var range: Range? = nil - @inlinable public init(key: RedisKey, bit: Int, range: Range? = nil) { + @inlinable public init(key: RESPKey, bit: Int, range: Range? = nil) { self.key = key self.bit = bit self.range = range } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("BITPOS", key, bit, range) } } /// Returns a bit value by offset. -public struct GETBIT: RedisCommand { +public struct GETBIT: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var offset: Int - @inlinable public init(key: RedisKey, offset: Int) { + @inlinable public init(key: RESPKey, offset: Int) { self.key = key self.offset = offset } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("GETBIT", key, offset) } } /// Sets or clears the bit at offset of the string value. Creates the key if it doesn't exist. -public struct SETBIT: RedisCommand { +public struct SETBIT: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var offset: Int public var value: Int - @inlinable public init(key: RedisKey, offset: Int, value: Int) { + @inlinable public init(key: RESPKey, offset: Int, value: Int) { self.key = key self.offset = offset self.value = value } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("SETBIT", key, offset, value) } } -extension RedisConnection { +extension ValkeyConnection { /// Counts the number of set bits (population counting) in a string. /// - /// - Documentation: [BITCOUNT](https:/redis.io/docs/latest/commands/bitcount) + /// - Documentation: [BITCOUNT](https:/valkey.io/commands/bitcount) /// - Version: 2.6.0 /// - Complexity: O(N) /// - Categories: @read, @bitmap, @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of bits set to 1. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of bits set to 1. @inlinable - public func bitcount(key: RedisKey, range: BITCOUNT.Range? = nil) async throws -> Int { + public func bitcount(key: RESPKey, range: BITCOUNT.Range? = nil) async throws -> Int { try await send(command: BITCOUNT(key: key, range: range)) } /// Performs arbitrary bitfield integer operations on strings. /// - /// - Documentation: [BITFIELD](https:/redis.io/docs/latest/commands/bitfield) + /// - Documentation: [BITFIELD](https:/valkey.io/commands/bitfield) /// - Version: 3.2.0 /// - Complexity: O(1) for each subcommand specified /// - Categories: @write, @bitmap, @slow /// - Returns: One of the following: - /// * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): each entry being the corresponding result of the sub-command given at the same position. - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): if OVERFLOW FAIL was given and overflows or underflows are detected. + /// * [Array](https:/valkey.io/topics/protocol/#arrays): each entry being the corresponding result of the sub-command given at the same position. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): if OVERFLOW FAIL was given and overflows or underflows are detected. @inlinable - public func bitfield(key: RedisKey, operation: [BITFIELD.Operation] = []) async throws -> [RESPToken]? { + public func bitfield(key: RESPKey, operation: [BITFIELD.Operation] = []) async throws -> [RESPToken]? { try await send(command: BITFIELD(key: key, operation: operation)) } /// Performs arbitrary read-only bitfield integer operations on strings. /// - /// - Documentation: [BITFIELD_RO](https:/redis.io/docs/latest/commands/bitfield_ro) + /// - Documentation: [BITFIELD_RO](https:/valkey.io/commands/bitfield_ro) /// - Version: 6.0.0 /// - Complexity: O(1) for each subcommand specified /// - Categories: @read, @bitmap, @fast - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): each entry being the corresponding result of the sub-command given at the same position. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): each entry being the corresponding result of the sub-command given at the same position. @inlinable - public func bitfieldRo(key: RedisKey, getBlock: [BITFIELDRO.GetBlock] = []) async throws -> [RESPToken] { + public func bitfieldRo(key: RESPKey, getBlock: [BITFIELDRO.GetBlock] = []) async throws -> [RESPToken] { try await send(command: BITFIELDRO(key: key, getBlock: getBlock)) } /// Performs bitwise operations on multiple strings, and stores the result. /// - /// - Documentation: [BITOP](https:/redis.io/docs/latest/commands/bitop) + /// - Documentation: [BITOP](https:/valkey.io/commands/bitop) /// - Version: 2.6.0 /// - Complexity: O(N) /// - Categories: @write, @bitmap, @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the size of the string stored in the destination key is equal to the size of the longest input string. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the size of the string stored in the destination key is equal to the size of the longest input string. @inlinable - public func bitop(operation: BITOP.Operation, destkey: RedisKey, key: [RedisKey]) async throws -> Int { + public func bitop(operation: BITOP.Operation, destkey: RESPKey, key: [RESPKey]) async throws -> Int { try await send(command: BITOP(operation: operation, destkey: destkey, key: key)) } /// Finds the first set (1) or clear (0) bit in a string. /// - /// - Documentation: [BITPOS](https:/redis.io/docs/latest/commands/bitpos) + /// - Documentation: [BITPOS](https:/valkey.io/commands/bitpos) /// - Version: 2.8.7 /// - Complexity: O(N) /// - Categories: @read, @bitmap, @slow /// - Returns: One of the following: - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the position of the first bit set to 1 or 0 according to the request - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `-1`. In case the `bit` argument is 1 and the string is empty or composed of just zero bytes + /// * [Integer](https:/valkey.io/topics/protocol/#integers): the position of the first bit set to 1 or 0 according to the request + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `-1`. In case the `bit` argument is 1 and the string is empty or composed of just zero bytes /// /// If we look for set bits (the bit argument is 1) and the string is empty or composed of just zero bytes, -1 is returned. /// @@ -399,33 +398,33 @@ extension RedisConnection { /// However, this behavior changes if you are looking for clear bits and specify a range with both _start_ and _end_. /// If a clear bit isn't found in the specified range, the function returns -1 as the user specified a clear range and there are no 0 bits in that range. @inlinable - public func bitpos(key: RedisKey, bit: Int, range: BITPOS.Range? = nil) async throws -> Int { + public func bitpos(key: RESPKey, bit: Int, range: BITPOS.Range? = nil) async throws -> Int { try await send(command: BITPOS(key: key, bit: bit, range: range)) } /// Returns a bit value by offset. /// - /// - Documentation: [GETBIT](https:/redis.io/docs/latest/commands/getbit) + /// - Documentation: [GETBIT](https:/valkey.io/commands/getbit) /// - Version: 2.2.0 /// - Complexity: O(1) /// - Categories: @read, @bitmap, @fast /// - Returns: The bit value stored at _offset_, one of the following: - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `0`. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `1`. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `0`. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `1`. @inlinable - public func getbit(key: RedisKey, offset: Int) async throws -> Int { + public func getbit(key: RESPKey, offset: Int) async throws -> Int { try await send(command: GETBIT(key: key, offset: offset)) } /// Sets or clears the bit at offset of the string value. Creates the key if it doesn't exist. /// - /// - Documentation: [SETBIT](https:/redis.io/docs/latest/commands/setbit) + /// - Documentation: [SETBIT](https:/valkey.io/commands/setbit) /// - Version: 2.2.0 /// - Complexity: O(1) /// - Categories: @write, @bitmap, @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the original bit value stored at _offset_. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the original bit value stored at _offset_. @inlinable - public func setbit(key: RedisKey, offset: Int, value: Int) async throws -> Int { + public func setbit(key: RESPKey, offset: Int, value: Int) async throws -> Int { try await send(command: SETBIT(key: key, offset: offset, value: value)) } diff --git a/Sources/RedisCommands/ClusterCommands.swift b/Sources/Valkey/Commands/ClusterCommands.swift similarity index 67% rename from Sources/RedisCommands/ClusterCommands.swift rename to Sources/Valkey/Commands/ClusterCommands.swift index 40f27e1f..57750452 100644 --- a/Sources/RedisCommands/ClusterCommands.swift +++ b/Sources/Valkey/Commands/ClusterCommands.swift @@ -1,21 +1,20 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -// This file is autogenerated by RedisCommandsBuilder +// This file is autogenerated by ValkeyCommandsBuilder import NIOCore -import Redis #if canImport(FoundationEssentials) import FoundationEssentials @@ -23,10 +22,10 @@ import FoundationEssentials import Foundation #endif -/// A container for Redis Cluster commands. +/// A container for Valkey Cluster commands. public enum CLUSTER { /// Assigns new hash slots to a node. - public struct ADDSLOTS: RedisCommand { + public struct ADDSLOTS: RESPCommand { public typealias Response = RESPToken public var slot: [Int] @@ -35,19 +34,19 @@ public enum CLUSTER { self.slot = slot } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "ADDSLOTS", slot) } } /// Assigns new hash slot ranges to a node. - public struct ADDSLOTSRANGE: RedisCommand { + public struct ADDSLOTSRANGE: RESPCommand { public struct Range: RESPRenderable { @usableFromInline let startSlot: Int @usableFromInline let endSlot: Int @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += startSlot.encode(into: &commandEncoder) count += endSlot.encode(into: &commandEncoder) @@ -62,26 +61,26 @@ public enum CLUSTER { self.range = range } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "ADDSLOTSRANGE", range) } } /// Advances the cluster config epoch. - public struct BUMPEPOCH: RedisCommand { + public struct BUMPEPOCH: RESPCommand { public typealias Response = String @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "BUMPEPOCH") } } /// Returns the number of active failure reports active for a node. - public struct COUNTFAILUREREPORTS: RedisCommand { + public struct COUNTFAILUREREPORTS: RESPCommand { public typealias Response = Int public var nodeId: String @@ -90,13 +89,13 @@ public enum CLUSTER { self.nodeId = nodeId } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "COUNT-FAILURE-REPORTS", nodeId) } } /// Returns the number of keys in a hash slot. - public struct COUNTKEYSINSLOT: RedisCommand { + public struct COUNTKEYSINSLOT: RESPCommand { public typealias Response = Int public var slot: Int @@ -105,13 +104,13 @@ public enum CLUSTER { self.slot = slot } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "COUNTKEYSINSLOT", slot) } } /// Sets hash slots as unbound for a node. - public struct DELSLOTS: RedisCommand { + public struct DELSLOTS: RESPCommand { public typealias Response = RESPToken public var slot: [Int] @@ -120,19 +119,19 @@ public enum CLUSTER { self.slot = slot } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "DELSLOTS", slot) } } /// Sets hash slot ranges as unbound for a node. - public struct DELSLOTSRANGE: RedisCommand { + public struct DELSLOTSRANGE: RESPCommand { public struct Range: RESPRenderable { @usableFromInline let startSlot: Int @usableFromInline let endSlot: Int @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += startSlot.encode(into: &commandEncoder) count += endSlot.encode(into: &commandEncoder) @@ -147,19 +146,19 @@ public enum CLUSTER { self.range = range } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "DELSLOTSRANGE", range) } } /// Forces a replica to perform a manual failover of its master. - public struct FAILOVER: RedisCommand { + public struct FAILOVER: RESPCommand { public enum Options: RESPRenderable { case force case takeover @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .force: "FORCE".encode(into: &commandEncoder) case .takeover: "TAKEOVER".encode(into: &commandEncoder) @@ -174,26 +173,26 @@ public enum CLUSTER { self.options = options } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "FAILOVER", options) } } /// Deletes all slots information from a node. - public struct FLUSHSLOTS: RedisCommand { + public struct FLUSHSLOTS: RESPCommand { public typealias Response = RESPToken @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "FLUSHSLOTS") } } /// Removes a node from the nodes table. - public struct FORGET: RedisCommand { + public struct FORGET: RESPCommand { public typealias Response = RESPToken public var nodeId: String @@ -202,13 +201,13 @@ public enum CLUSTER { self.nodeId = nodeId } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "FORGET", nodeId) } } /// Returns the key names in a hash slot. - public struct GETKEYSINSLOT: RedisCommand { + public struct GETKEYSINSLOT: RESPCommand { public typealias Response = [RESPToken] public var slot: Int @@ -219,39 +218,39 @@ public enum CLUSTER { self.count = count } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "GETKEYSINSLOT", slot, count) } } /// Returns helpful text about the different subcommands. - public struct HELP: RedisCommand { + public struct HELP: RESPCommand { public typealias Response = [RESPToken] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "HELP") } } /// Returns information about the state of a node. - public struct INFO: RedisCommand { + public struct INFO: RESPCommand { public typealias Response = String @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "INFO") } } /// Returns the hash slot for a key. - public struct KEYSLOT: RedisCommand { + public struct KEYSLOT: RESPCommand { public typealias Response = Int public var key: String @@ -260,26 +259,26 @@ public enum CLUSTER { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "KEYSLOT", key) } } /// Returns a list of all TCP links to and from peer nodes. - public struct LINKS: RedisCommand { + public struct LINKS: RESPCommand { public typealias Response = [[String: RESPToken]] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "LINKS") } } /// Forces a node to handshake with another node. - public struct MEET: RedisCommand { + public struct MEET: RESPCommand { public typealias Response = RESPToken public var ip: String @@ -292,52 +291,52 @@ public enum CLUSTER { self.clusterBusPort = clusterBusPort } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "MEET", ip, port, clusterBusPort) } } /// Returns the ID of a node. - public struct MYID: RedisCommand { + public struct MYID: RESPCommand { public typealias Response = String @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "MYID") } } /// Returns the shard ID of a node. - public struct MYSHARDID: RedisCommand { + public struct MYSHARDID: RESPCommand { public typealias Response = String @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "MYSHARDID") } } /// Returns the cluster configuration for a node. - public struct NODES: RedisCommand { + public struct NODES: RESPCommand { public typealias Response = String @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "NODES") } } /// Lists the replica nodes of a master node. - public struct REPLICAS: RedisCommand { + public struct REPLICAS: RESPCommand { public typealias Response = [RESPToken] public var nodeId: String @@ -346,13 +345,13 @@ public enum CLUSTER { self.nodeId = nodeId } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "REPLICAS", nodeId) } } /// Configure a node as replica of a master node. - public struct REPLICATE: RedisCommand { + public struct REPLICATE: RESPCommand { public typealias Response = RESPToken public var nodeId: String @@ -361,19 +360,19 @@ public enum CLUSTER { self.nodeId = nodeId } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "REPLICATE", nodeId) } } /// Resets a node. - public struct RESET: RedisCommand { + public struct RESET: RESPCommand { public enum ResetType: RESPRenderable { case hard case soft @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .hard: "HARD".encode(into: &commandEncoder) case .soft: "SOFT".encode(into: &commandEncoder) @@ -388,26 +387,26 @@ public enum CLUSTER { self.resetType = resetType } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "RESET", resetType) } } /// Forces a node to save the cluster configuration to disk. - public struct SAVECONFIG: RedisCommand { + public struct SAVECONFIG: RESPCommand { public typealias Response = RESPToken @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "SAVECONFIG") } } /// Sets the configuration epoch for a new node. - public struct SETCONFIGEPOCH: RedisCommand { + public struct SETCONFIGEPOCH: RESPCommand { public typealias Response = RESPToken public var configEpoch: Int @@ -416,13 +415,13 @@ public enum CLUSTER { self.configEpoch = configEpoch } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "SET-CONFIG-EPOCH", configEpoch) } } /// Binds a hash slot to a node. - public struct SETSLOT: RedisCommand { + public struct SETSLOT: RESPCommand { public enum Subcommand: RESPRenderable { case importing(String) case migrating(String) @@ -430,7 +429,7 @@ public enum CLUSTER { case stable @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .importing(let importing): RESPWithToken("IMPORTING", importing).encode(into: &commandEncoder) case .migrating(let migrating): RESPWithToken("MIGRATING", migrating).encode(into: &commandEncoder) @@ -449,26 +448,26 @@ public enum CLUSTER { self.subcommand = subcommand } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "SETSLOT", slot, subcommand) } } /// Returns the mapping of cluster slots to shards. - public struct SHARDS: RedisCommand { + public struct SHARDS: RESPCommand { public typealias Response = [RESPToken] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "SHARDS") } } /// Lists the replica nodes of a master node. - public struct SLAVES: RedisCommand { + public struct SLAVES: RESPCommand { public typealias Response = [RESPToken] public var nodeId: String @@ -477,20 +476,20 @@ public enum CLUSTER { self.nodeId = nodeId } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "SLAVES", nodeId) } } /// Returns the mapping of cluster slots to nodes. - public struct SLOTS: RedisCommand { + public struct SLOTS: RESPCommand { public typealias Response = [RESPToken] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLUSTER", "SLOTS") } } @@ -498,53 +497,53 @@ public enum CLUSTER { } /// Signals that a cluster client is following an -ASK redirect. -public struct ASKING: RedisCommand { +public struct ASKING: RESPCommand { public typealias Response = RESPToken @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ASKING") } } -/// Enables read-only queries for a connection to a Redis Cluster replica node. -public struct READONLY: RedisCommand { +/// Enables read-only queries for a connection to a Valkey Cluster replica node. +public struct READONLY: RESPCommand { public typealias Response = RESPToken @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("READONLY") } } /// Enables read-write queries for a connection to a Reids Cluster replica node. -public struct READWRITE: RedisCommand { +public struct READWRITE: RESPCommand { public typealias Response = RESPToken @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("READWRITE") } } -extension RedisConnection { +extension ValkeyConnection { /// Signals that a cluster client is following an -ASK redirect. /// - /// - Documentation: [ASKING](https:/redis.io/docs/latest/commands/asking) + /// - Documentation: [ASKING](https:/valkey.io/commands/asking) /// - Version: 3.0.0 /// - Complexity: O(1) /// - Categories: @fast, @connection - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func asking() async throws -> RESPToken { try await send(command: ASKING()) @@ -552,11 +551,11 @@ extension RedisConnection { /// Assigns new hash slots to a node. /// - /// - Documentation: [CLUSTER ADDSLOTS](https:/redis.io/docs/latest/commands/cluster-addslots) + /// - Documentation: [CLUSTER ADDSLOTS](https:/valkey.io/commands/cluster-addslots) /// - Version: 3.0.0 /// - Complexity: O(N) where N is the total number of hash slot arguments /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` if the command was successful. Otherwise an error is returned. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` if the command was successful. Otherwise an error is returned. @inlinable public func clusterAddslots(slot: [Int]) async throws -> RESPToken { try await send(command: CLUSTER.ADDSLOTS(slot: slot)) @@ -564,11 +563,11 @@ extension RedisConnection { /// Assigns new hash slot ranges to a node. /// - /// - Documentation: [CLUSTER ADDSLOTSRANGE](https:/redis.io/docs/latest/commands/cluster-addslotsrange) + /// - Documentation: [CLUSTER ADDSLOTSRANGE](https:/valkey.io/commands/cluster-addslotsrange) /// - Version: 7.0.0 /// - Complexity: O(N) where N is the total number of the slots between the start slot and end slot arguments. /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` if the command was successful. Otherwise an error is returned. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` if the command was successful. Otherwise an error is returned. @inlinable public func clusterAddslotsrange(range: [CLUSTER.ADDSLOTSRANGE.Range]) async throws -> RESPToken { try await send(command: CLUSTER.ADDSLOTSRANGE(range: range)) @@ -576,13 +575,13 @@ extension RedisConnection { /// Advances the cluster config epoch. /// - /// - Documentation: [CLUSTER BUMPEPOCH](https:/redis.io/docs/latest/commands/cluster-bumpepoch) + /// - Documentation: [CLUSTER BUMPEPOCH](https:/valkey.io/commands/cluster-bumpepoch) /// - Version: 3.0.0 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous /// - Returns: One of the following: - /// * [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): `BUMPED` if the epoch was incremented. - /// * [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): `STILL` if the node already has the greatest configured epoch in the cluster. + /// * [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): `BUMPED` if the epoch was incremented. + /// * [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): `STILL` if the node already has the greatest configured epoch in the cluster. @inlinable public func clusterBumpepoch() async throws -> String { try await send(command: CLUSTER.BUMPEPOCH()) @@ -590,11 +589,11 @@ extension RedisConnection { /// Returns the number of active failure reports active for a node. /// - /// - Documentation: [CLUSTER COUNT-FAILURE-REPORTS](https:/redis.io/docs/latest/commands/cluster-count-failure-reports) + /// - Documentation: [CLUSTER COUNT-FAILURE-REPORTS](https:/valkey.io/commands/cluster-count-failure-reports) /// - Version: 3.0.0 /// - Complexity: O(N) where N is the number of failure reports /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of active failure reports for the node. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of active failure reports for the node. @inlinable public func clusterCountFailureReports(nodeId: String) async throws -> Int { try await send(command: CLUSTER.COUNTFAILUREREPORTS(nodeId: nodeId)) @@ -602,11 +601,11 @@ extension RedisConnection { /// Returns the number of keys in a hash slot. /// - /// - Documentation: [CLUSTER COUNTKEYSINSLOT](https:/redis.io/docs/latest/commands/cluster-countkeysinslot) + /// - Documentation: [CLUSTER COUNTKEYSINSLOT](https:/valkey.io/commands/cluster-countkeysinslot) /// - Version: 3.0.0 /// - Complexity: O(1) /// - Categories: @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): The number of keys in the specified hash slot, or an error if the hash slot is invalid. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): The number of keys in the specified hash slot, or an error if the hash slot is invalid. @inlinable public func clusterCountkeysinslot(slot: Int) async throws -> Int { try await send(command: CLUSTER.COUNTKEYSINSLOT(slot: slot)) @@ -614,11 +613,11 @@ extension RedisConnection { /// Sets hash slots as unbound for a node. /// - /// - Documentation: [CLUSTER DELSLOTS](https:/redis.io/docs/latest/commands/cluster-delslots) + /// - Documentation: [CLUSTER DELSLOTS](https:/valkey.io/commands/cluster-delslots) /// - Version: 3.0.0 /// - Complexity: O(N) where N is the total number of hash slot arguments /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` if the command was successful. Otherwise an error is returned. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` if the command was successful. Otherwise an error is returned. @inlinable public func clusterDelslots(slot: [Int]) async throws -> RESPToken { try await send(command: CLUSTER.DELSLOTS(slot: slot)) @@ -626,11 +625,11 @@ extension RedisConnection { /// Sets hash slot ranges as unbound for a node. /// - /// - Documentation: [CLUSTER DELSLOTSRANGE](https:/redis.io/docs/latest/commands/cluster-delslotsrange) + /// - Documentation: [CLUSTER DELSLOTSRANGE](https:/valkey.io/commands/cluster-delslotsrange) /// - Version: 7.0.0 /// - Complexity: O(N) where N is the total number of the slots between the start slot and end slot arguments. /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` if the command was successful. Otherwise an error is returned. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` if the command was successful. Otherwise an error is returned. @inlinable public func clusterDelslotsrange(range: [CLUSTER.DELSLOTSRANGE.Range]) async throws -> RESPToken { try await send(command: CLUSTER.DELSLOTSRANGE(range: range)) @@ -638,11 +637,11 @@ extension RedisConnection { /// Forces a replica to perform a manual failover of its master. /// - /// - Documentation: [CLUSTER FAILOVER](https:/redis.io/docs/latest/commands/cluster-failover) + /// - Documentation: [CLUSTER FAILOVER](https:/valkey.io/commands/cluster-failover) /// - Version: 3.0.0 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` if the command was accepted and a manual failover is going to be attempted. An error if the operation cannot be executed, for example if the client is connected to a node that is already a master. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` if the command was accepted and a manual failover is going to be attempted. An error if the operation cannot be executed, for example if the client is connected to a node that is already a primary. @inlinable public func clusterFailover(options: CLUSTER.FAILOVER.Options? = nil) async throws -> RESPToken { try await send(command: CLUSTER.FAILOVER(options: options)) @@ -650,11 +649,11 @@ extension RedisConnection { /// Deletes all slots information from a node. /// - /// - Documentation: [CLUSTER FLUSHSLOTS](https:/redis.io/docs/latest/commands/cluster-flushslots) + /// - Documentation: [CLUSTER FLUSHSLOTS](https:/valkey.io/commands/cluster-flushslots) /// - Version: 3.0.0 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func clusterFlushslots() async throws -> RESPToken { try await send(command: CLUSTER.FLUSHSLOTS()) @@ -662,11 +661,11 @@ extension RedisConnection { /// Removes a node from the nodes table. /// - /// - Documentation: [CLUSTER FORGET](https:/redis.io/docs/latest/commands/cluster-forget) + /// - Documentation: [CLUSTER FORGET](https:/valkey.io/commands/cluster-forget) /// - Version: 3.0.0 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` if the command was executed successfully. Otherwise an error is returned. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` if the command was executed successfully. Otherwise an error is returned. @inlinable public func clusterForget(nodeId: String) async throws -> RESPToken { try await send(command: CLUSTER.FORGET(nodeId: nodeId)) @@ -674,11 +673,11 @@ extension RedisConnection { /// Returns the key names in a hash slot. /// - /// - Documentation: [CLUSTER GETKEYSINSLOT](https:/redis.io/docs/latest/commands/cluster-getkeysinslot) + /// - Documentation: [CLUSTER GETKEYSINSLOT](https:/valkey.io/commands/cluster-getkeysinslot) /// - Version: 3.0.0 /// - Complexity: O(N) where N is the number of requested keys /// - Categories: @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): an array with up to count elements. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): an array with up to count elements. @inlinable public func clusterGetkeysinslot(slot: Int, count: Int) async throws -> [RESPToken] { try await send(command: CLUSTER.GETKEYSINSLOT(slot: slot, count: count)) @@ -686,11 +685,11 @@ extension RedisConnection { /// Returns helpful text about the different subcommands. /// - /// - Documentation: [CLUSTER HELP](https:/redis.io/docs/latest/commands/cluster-help) + /// - Documentation: [CLUSTER HELP](https:/valkey.io/commands/cluster-help) /// - Version: 5.0.0 /// - Complexity: O(1) /// - Categories: @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of subcommands and their descriptions. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of subcommands and their descriptions. @inlinable public func clusterHelp() async throws -> [RESPToken] { try await send(command: CLUSTER.HELP()) @@ -698,11 +697,11 @@ extension RedisConnection { /// Returns information about the state of a node. /// - /// - Documentation: [CLUSTER INFO](https:/redis.io/docs/latest/commands/cluster-info) + /// - Documentation: [CLUSTER INFO](https:/valkey.io/commands/cluster-info) /// - Version: 3.0.0 /// - Complexity: O(1) /// - Categories: @slow - /// - Returns: [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): A map between named fields and values in the form of : lines separated by newlines composed by the two bytes CRLF + /// - Returns: [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): A map between named fields and values in the form of `:` lines separated by newlines composed by the two bytes `CRLF`. @inlinable public func clusterInfo() async throws -> String { try await send(command: CLUSTER.INFO()) @@ -710,11 +709,11 @@ extension RedisConnection { /// Returns the hash slot for a key. /// - /// - Documentation: [CLUSTER KEYSLOT](https:/redis.io/docs/latest/commands/cluster-keyslot) + /// - Documentation: [CLUSTER KEYSLOT](https:/valkey.io/commands/cluster-keyslot) /// - Version: 3.0.0 /// - Complexity: O(N) where N is the number of bytes in the key /// - Categories: @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): The hash slot number for the specified key + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): The hash slot number for the specified key @inlinable public func clusterKeyslot(key: String) async throws -> Int { try await send(command: CLUSTER.KEYSLOT(key: key)) @@ -722,11 +721,11 @@ extension RedisConnection { /// Returns a list of all TCP links to and from peer nodes. /// - /// - Documentation: [CLUSTER LINKS](https:/redis.io/docs/latest/commands/cluster-links) + /// - Documentation: [CLUSTER LINKS](https:/valkey.io/commands/cluster-links) /// - Version: 7.0.0 /// - Complexity: O(N) where N is the total number of Cluster nodes /// - Categories: @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): an array of [Map](https:/redis.io/docs/reference/protocol-spec#maps) where each map contains various attributes and their values of a cluster link. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): an array of [Map](https:/valkey.io/topics/protocol/#maps) where each map contains various attributes and their values of a cluster link. @inlinable public func clusterLinks() async throws -> [[String: RESPToken]] { try await send(command: CLUSTER.LINKS()) @@ -734,11 +733,11 @@ extension RedisConnection { /// Forces a node to handshake with another node. /// - /// - Documentation: [CLUSTER MEET](https:/redis.io/docs/latest/commands/cluster-meet) + /// - Documentation: [CLUSTER MEET](https:/valkey.io/commands/cluster-meet) /// - Version: 3.0.0 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` if the command was successful. If the address or port specified are invalid an error is returned. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` if the command was successful. If the port or cluster bus port number is out of range, or if an invalid address is specified, an error is returned. @inlinable public func clusterMeet(ip: String, port: Int, clusterBusPort: Int? = nil) async throws -> RESPToken { try await send(command: CLUSTER.MEET(ip: ip, port: port, clusterBusPort: clusterBusPort)) @@ -746,11 +745,11 @@ extension RedisConnection { /// Returns the ID of a node. /// - /// - Documentation: [CLUSTER MYID](https:/redis.io/docs/latest/commands/cluster-myid) + /// - Documentation: [CLUSTER MYID](https:/valkey.io/commands/cluster-myid) /// - Version: 3.0.0 /// - Complexity: O(1) /// - Categories: @slow - /// - Returns: [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): the node ID. + /// - Returns: [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): the node ID. @inlinable public func clusterMyid() async throws -> String { try await send(command: CLUSTER.MYID()) @@ -758,11 +757,11 @@ extension RedisConnection { /// Returns the shard ID of a node. /// - /// - Documentation: [CLUSTER MYSHARDID](https:/redis.io/docs/latest/commands/cluster-myshardid) + /// - Documentation: [CLUSTER MYSHARDID](https:/valkey.io/commands/cluster-myshardid) /// - Version: 7.2.0 /// - Complexity: O(1) /// - Categories: @slow - /// - Returns: [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): the node's shard ID. + /// - Returns: [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): the node's shard ID. @inlinable public func clusterMyshardid() async throws -> String { try await send(command: CLUSTER.MYSHARDID()) @@ -770,11 +769,11 @@ extension RedisConnection { /// Returns the cluster configuration for a node. /// - /// - Documentation: [CLUSTER NODES](https:/redis.io/docs/latest/commands/cluster-nodes) + /// - Documentation: [CLUSTER NODES](https:/valkey.io/commands/cluster-nodes) /// - Version: 3.0.0 /// - Complexity: O(N) where N is the total number of Cluster nodes /// - Categories: @slow - /// - Returns: [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): the serialized cluster configuration. + /// - Returns: [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): the serialized cluster configuration. @inlinable public func clusterNodes() async throws -> String { try await send(command: CLUSTER.NODES()) @@ -782,11 +781,11 @@ extension RedisConnection { /// Lists the replica nodes of a master node. /// - /// - Documentation: [CLUSTER REPLICAS](https:/redis.io/docs/latest/commands/cluster-replicas) + /// - Documentation: [CLUSTER REPLICAS](https:/valkey.io/commands/cluster-replicas) /// - Version: 5.0.0 /// - Complexity: O(N) where N is the number of replicas. /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of replica nodes replicating from the specified master node provided in the same format used by `CLUSTER NODES`. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of replica nodes replicating from the specified primary node provided in the same format used by `CLUSTER NODES`. @inlinable public func clusterReplicas(nodeId: String) async throws -> [RESPToken] { try await send(command: CLUSTER.REPLICAS(nodeId: nodeId)) @@ -794,11 +793,11 @@ extension RedisConnection { /// Configure a node as replica of a master node. /// - /// - Documentation: [CLUSTER REPLICATE](https:/redis.io/docs/latest/commands/cluster-replicate) + /// - Documentation: [CLUSTER REPLICATE](https:/valkey.io/commands/cluster-replicate) /// - Version: 3.0.0 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` if the command was successful. Otherwise an error is returned. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` if the command was successful. Otherwise an error is returned. @inlinable public func clusterReplicate(nodeId: String) async throws -> RESPToken { try await send(command: CLUSTER.REPLICATE(nodeId: nodeId)) @@ -806,11 +805,11 @@ extension RedisConnection { /// Resets a node. /// - /// - Documentation: [CLUSTER RESET](https:/redis.io/docs/latest/commands/cluster-reset) + /// - Documentation: [CLUSTER RESET](https:/valkey.io/commands/cluster-reset) /// - Version: 3.0.0 /// - Complexity: O(N) where N is the number of known nodes. The command may execute a FLUSHALL as a side effect. /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` if the command was successful. Otherwise an error is returned. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` if the command was successful. Otherwise an error is returned. @inlinable public func clusterReset(resetType: CLUSTER.RESET.ResetType? = nil) async throws -> RESPToken { try await send(command: CLUSTER.RESET(resetType: resetType)) @@ -818,11 +817,11 @@ extension RedisConnection { /// Forces a node to save the cluster configuration to disk. /// - /// - Documentation: [CLUSTER SAVECONFIG](https:/redis.io/docs/latest/commands/cluster-saveconfig) + /// - Documentation: [CLUSTER SAVECONFIG](https:/valkey.io/commands/cluster-saveconfig) /// - Version: 3.0.0 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` if the command was successful. Otherwise an error is returned. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` if the command was successful. Otherwise an error is returned. @inlinable public func clusterSaveconfig() async throws -> RESPToken { try await send(command: CLUSTER.SAVECONFIG()) @@ -830,11 +829,11 @@ extension RedisConnection { /// Sets the configuration epoch for a new node. /// - /// - Documentation: [CLUSTER SET-CONFIG-EPOCH](https:/redis.io/docs/latest/commands/cluster-set-config-epoch) + /// - Documentation: [CLUSTER SET-CONFIG-EPOCH](https:/valkey.io/commands/cluster-set-config-epoch) /// - Version: 3.0.0 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` if the command was successful. Otherwise an error is returned. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` if the command was successful. Otherwise an error is returned. @inlinable public func clusterSetConfigEpoch(configEpoch: Int) async throws -> RESPToken { try await send(command: CLUSTER.SETCONFIGEPOCH(configEpoch: configEpoch)) @@ -842,11 +841,11 @@ extension RedisConnection { /// Binds a hash slot to a node. /// - /// - Documentation: [CLUSTER SETSLOT](https:/redis.io/docs/latest/commands/cluster-setslot) + /// - Documentation: [CLUSTER SETSLOT](https:/valkey.io/commands/cluster-setslot) /// - Version: 3.0.0 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): all the sub-commands return `OK` if the command was successful. Otherwise an error is returned. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): all the sub-commands return `OK` if the command was successful. Otherwise an error is returned. @inlinable public func clusterSetslot(slot: Int, subcommand: CLUSTER.SETSLOT.Subcommand) async throws -> RESPToken { try await send(command: CLUSTER.SETSLOT(slot: slot, subcommand: subcommand)) @@ -854,11 +853,11 @@ extension RedisConnection { /// Returns the mapping of cluster slots to shards. /// - /// - Documentation: [CLUSTER SHARDS](https:/redis.io/docs/latest/commands/cluster-shards) + /// - Documentation: [CLUSTER SHARDS](https:/valkey.io/commands/cluster-shards) /// - Version: 7.0.0 /// - Complexity: O(N) where N is the total number of cluster nodes /// - Categories: @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a nested list of [Map](https:/redis.io/docs/reference/protocol-spec#maps) of hash ranges and shard nodes describing individual shards. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a nested list of [Map](https:/valkey.io/topics/protocol/#maps) of hash ranges and shard nodes describing individual shards. @inlinable public func clusterShards() async throws -> [RESPToken] { try await send(command: CLUSTER.SHARDS()) @@ -866,11 +865,11 @@ extension RedisConnection { /// Lists the replica nodes of a master node. /// - /// - Documentation: [CLUSTER SLAVES](https:/redis.io/docs/latest/commands/cluster-slaves) + /// - Documentation: [CLUSTER SLAVES](https:/valkey.io/commands/cluster-slaves) /// - Version: 3.0.0 /// - Complexity: O(N) where N is the number of replicas. /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of replica nodes replicating from the specified master node provided in the same format used by `CLUSTER NODES`. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of replica nodes replicating from the specified primary node provided in the same format used by `CLUSTER NODES`. @inlinable public func clusterSlaves(nodeId: String) async throws -> [RESPToken] { try await send(command: CLUSTER.SLAVES(nodeId: nodeId)) @@ -878,23 +877,23 @@ extension RedisConnection { /// Returns the mapping of cluster slots to nodes. /// - /// - Documentation: [CLUSTER SLOTS](https:/redis.io/docs/latest/commands/cluster-slots) + /// - Documentation: [CLUSTER SLOTS](https:/valkey.io/commands/cluster-slots) /// - Version: 3.0.0 /// - Complexity: O(N) where N is the total number of Cluster nodes /// - Categories: @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): nested list of slot ranges with networking information. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): nested list of slot ranges with networking information. @inlinable public func clusterSlots() async throws -> [RESPToken] { try await send(command: CLUSTER.SLOTS()) } - /// Enables read-only queries for a connection to a Redis Cluster replica node. + /// Enables read-only queries for a connection to a Valkey Cluster replica node. /// - /// - Documentation: [READONLY](https:/redis.io/docs/latest/commands/readonly) + /// - Documentation: [READONLY](https:/valkey.io/commands/readonly) /// - Version: 3.0.0 /// - Complexity: O(1) /// - Categories: @fast, @connection - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func readonly() async throws -> RESPToken { try await send(command: READONLY()) @@ -902,11 +901,11 @@ extension RedisConnection { /// Enables read-write queries for a connection to a Reids Cluster replica node. /// - /// - Documentation: [READWRITE](https:/redis.io/docs/latest/commands/readwrite) + /// - Documentation: [READWRITE](https:/valkey.io/commands/readwrite) /// - Version: 3.0.0 /// - Complexity: O(1) /// - Categories: @fast, @connection - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func readwrite() async throws -> RESPToken { try await send(command: READWRITE()) diff --git a/Sources/RedisCommands/ConnectionCommands.swift b/Sources/Valkey/Commands/ConnectionCommands.swift similarity index 70% rename from Sources/RedisCommands/ConnectionCommands.swift rename to Sources/Valkey/Commands/ConnectionCommands.swift index a9590181..1629fcd4 100644 --- a/Sources/RedisCommands/ConnectionCommands.swift +++ b/Sources/Valkey/Commands/ConnectionCommands.swift @@ -1,21 +1,20 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -// This file is autogenerated by RedisCommandsBuilder +// This file is autogenerated by ValkeyCommandsBuilder import NIOCore -import Redis #if canImport(FoundationEssentials) import FoundationEssentials @@ -26,13 +25,13 @@ import Foundation /// A container for client connection commands. public enum CLIENT { /// Instructs the server whether to track the keys in the next request. - public struct CACHING: RedisCommand { + public struct CACHING: RESPCommand { public enum Mode: RESPRenderable { case yes case no @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .yes: "YES".encode(into: &commandEncoder) case .no: "NO".encode(into: &commandEncoder) @@ -47,78 +46,78 @@ public enum CLIENT { self.mode = mode } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLIENT", "CACHING", mode) } } /// Returns the name of the connection. - public struct GETNAME: RedisCommand { + public struct GETNAME: RESPCommand { public typealias Response = String? @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLIENT", "GETNAME") } } /// Returns the client ID to which the connection's tracking notifications are redirected. - public struct GETREDIR: RedisCommand { + public struct GETREDIR: RESPCommand { public typealias Response = Int @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLIENT", "GETREDIR") } } /// Returns helpful text about the different subcommands. - public struct HELP: RedisCommand { + public struct HELP: RESPCommand { public typealias Response = [RESPToken] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLIENT", "HELP") } } /// Returns the unique client ID of the connection. - public struct ID: RedisCommand { + public struct ID: RESPCommand { public typealias Response = Int @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLIENT", "ID") } } /// Returns information about the connection. - public struct INFO: RedisCommand { + public struct INFO: RESPCommand { public typealias Response = String @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLIENT", "INFO") } } /// Terminates open connections. - public struct KILL: RedisCommand { + public struct KILL: RESPCommand { public enum FilterNewFormatClientType: RESPRenderable { case normal case master @@ -127,7 +126,7 @@ public enum CLIENT { case pubsub @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .normal: "NORMAL".encode(into: &commandEncoder) case .master: "MASTER".encode(into: &commandEncoder) @@ -142,7 +141,7 @@ public enum CLIENT { case no @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .yes: "YES".encode(into: &commandEncoder) case .no: "NO".encode(into: &commandEncoder) @@ -158,7 +157,7 @@ public enum CLIENT { case skipme(FilterNewFormatSkipme?) @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .clientId(let clientId): RESPWithToken("ID", clientId).encode(into: &commandEncoder) case .clientType(let clientType): RESPWithToken("TYPE", clientType).encode(into: &commandEncoder) @@ -174,7 +173,7 @@ public enum CLIENT { case newFormat([FilterNewFormat]) @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .oldFormat(let oldFormat): oldFormat.encode(into: &commandEncoder) case .newFormat(let newFormat): newFormat.encode(into: &commandEncoder) @@ -189,13 +188,13 @@ public enum CLIENT { self.filter = filter } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLIENT", "KILL", filter) } } /// Lists open connections. - public struct LIST: RedisCommand { + public struct LIST: RESPCommand { public enum ClientType: RESPRenderable { case normal case master @@ -203,7 +202,7 @@ public enum CLIENT { case pubsub @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .normal: "NORMAL".encode(into: &commandEncoder) case .master: "MASTER".encode(into: &commandEncoder) @@ -222,19 +221,19 @@ public enum CLIENT { self.clientId = clientId } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLIENT", "LIST", RESPWithToken("TYPE", clientType), RESPWithToken("ID", clientId)) } } /// Sets the client eviction mode of the connection. - public struct NOEVICT: RedisCommand { + public struct NOEVICT: RESPCommand { public enum Enabled: RESPRenderable { case on case off @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .on: "ON".encode(into: &commandEncoder) case .off: "OFF".encode(into: &commandEncoder) @@ -249,19 +248,19 @@ public enum CLIENT { self.enabled = enabled } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLIENT", "NO-EVICT", enabled) } } /// Controls whether commands sent by the client affect the LRU/LFU of accessed keys. - public struct NOTOUCH: RedisCommand { + public struct NOTOUCH: RESPCommand { public enum Enabled: RESPRenderable { case on case off @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .on: "ON".encode(into: &commandEncoder) case .off: "OFF".encode(into: &commandEncoder) @@ -276,19 +275,19 @@ public enum CLIENT { self.enabled = enabled } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLIENT", "NO-TOUCH", enabled) } } /// Suspends commands processing. - public struct PAUSE: RedisCommand { + public struct PAUSE: RESPCommand { public enum Mode: RESPRenderable { case write case all @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .write: "WRITE".encode(into: &commandEncoder) case .all: "ALL".encode(into: &commandEncoder) @@ -305,20 +304,20 @@ public enum CLIENT { self.mode = mode } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLIENT", "PAUSE", timeout, mode) } } /// Instructs the server whether to reply to commands. - public struct REPLY: RedisCommand { + public struct REPLY: RESPCommand { public enum Action: RESPRenderable { case on case off case skip @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .on: "ON".encode(into: &commandEncoder) case .off: "OFF".encode(into: &commandEncoder) @@ -334,19 +333,19 @@ public enum CLIENT { self.action = action } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLIENT", "REPLY", action) } } /// Sets information specific to the client or connection. - public struct SETINFO: RedisCommand { + public struct SETINFO: RESPCommand { public enum Attr: RESPRenderable { case libname(String) case libver(String) @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .libname(let libname): RESPWithToken("LIB-NAME", libname).encode(into: &commandEncoder) case .libver(let libver): RESPWithToken("LIB-VER", libver).encode(into: &commandEncoder) @@ -361,13 +360,13 @@ public enum CLIENT { self.attr = attr } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLIENT", "SETINFO", attr) } } /// Sets the connection name. - public struct SETNAME: RedisCommand { + public struct SETNAME: RESPCommand { public typealias Response = RESPToken public var connectionName: String @@ -376,19 +375,19 @@ public enum CLIENT { self.connectionName = connectionName } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLIENT", "SETNAME", connectionName) } } /// Controls server-assisted client-side caching for the connection. - public struct TRACKING: RedisCommand { + public struct TRACKING: RESPCommand { public enum Status: RESPRenderable { case on case off @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .on: "ON".encode(into: &commandEncoder) case .off: "OFF".encode(into: &commandEncoder) @@ -415,32 +414,32 @@ public enum CLIENT { self.noloop = noloop } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("CLIENT", "TRACKING", status, RESPWithToken("REDIRECT", clientId), RESPWithToken("PREFIX", prefix), RedisPureToken("BCAST", bcast), RedisPureToken("OPTIN", optin), RedisPureToken("OPTOUT", optout), RedisPureToken("NOLOOP", noloop)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("CLIENT", "TRACKING", status, RESPWithToken("REDIRECT", clientId), RESPWithToken("PREFIX", prefix), RESPPureToken("BCAST", bcast), RESPPureToken("OPTIN", optin), RESPPureToken("OPTOUT", optout), RESPPureToken("NOLOOP", noloop)) } } /// Returns information about server-assisted client-side caching for the connection. - public struct TRACKINGINFO: RedisCommand { + public struct TRACKINGINFO: RESPCommand { public typealias Response = [String: RESPToken] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLIENT", "TRACKINGINFO") } } /// Unblocks a client blocked by a blocking command from a different connection. - public struct UNBLOCK: RedisCommand { + public struct UNBLOCK: RESPCommand { public enum UnblockType: RESPRenderable { case timeout case error @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .timeout: "TIMEOUT".encode(into: &commandEncoder) case .error: "ERROR".encode(into: &commandEncoder) @@ -457,20 +456,20 @@ public enum CLIENT { self.unblockType = unblockType } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLIENT", "UNBLOCK", clientId, unblockType) } } /// Resumes processing commands from paused clients. - public struct UNPAUSE: RedisCommand { + public struct UNPAUSE: RESPCommand { public typealias Response = RESPToken @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CLIENT", "UNPAUSE") } } @@ -478,7 +477,7 @@ public enum CLIENT { } /// Authenticates the connection. -public struct AUTH: RedisCommand { +public struct AUTH: RESPCommand { public typealias Response = RESPToken public var username: String? = nil @@ -489,13 +488,13 @@ public struct AUTH: RedisCommand { self.password = password } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("AUTH", username, password) } } /// Returns the given string. -public struct ECHO: RedisCommand { +public struct ECHO: RESPCommand { public typealias Response = String public var message: String @@ -504,19 +503,19 @@ public struct ECHO: RedisCommand { self.message = message } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ECHO", message) } } -/// Handshakes with the Redis server. -public struct HELLO: RedisCommand { +/// Handshakes with the Valkey server. +public struct HELLO: RESPCommand { public struct ArgumentsAuth: RESPRenderable { @usableFromInline let username: String @usableFromInline let password: String @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += username.encode(into: &commandEncoder) count += password.encode(into: &commandEncoder) @@ -529,7 +528,7 @@ public struct HELLO: RedisCommand { @usableFromInline let clientname: String? @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += protover.encode(into: &commandEncoder) count += RESPWithToken("AUTH", auth).encode(into: &commandEncoder) @@ -545,13 +544,13 @@ public struct HELLO: RedisCommand { self.arguments = arguments } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("HELLO", arguments) } } /// Returns the server's liveliness response. -public struct PING: RedisCommand { +public struct PING: RESPCommand { public typealias Response = String public var message: String? = nil @@ -560,39 +559,39 @@ public struct PING: RedisCommand { self.message = message } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("PING", message) } } /// Closes the connection. -public struct QUIT: RedisCommand { +public struct QUIT: RESPCommand { public typealias Response = RESPToken @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("QUIT") } } /// Resets the connection. -public struct RESET: RedisCommand { +public struct RESET: RESPCommand { public typealias Response = String @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("RESET") } } /// Changes the selected database. -public struct SELECT: RedisCommand { +public struct SELECT: RESPCommand { public typealias Response = RESPToken public var index: Int @@ -601,20 +600,20 @@ public struct SELECT: RedisCommand { self.index = index } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("SELECT", index) } } -extension RedisConnection { +extension ValkeyConnection { /// Authenticates the connection. /// - /// - Documentation: [AUTH](https:/redis.io/docs/latest/commands/auth) + /// - Documentation: [AUTH](https:/valkey.io/commands/auth) /// - Version: 1.0.0 /// - Complexity: O(N) where N is the number of passwords defined for the user /// - Categories: @fast, @connection - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`, or an error if the password, or username/password pair, is invalid. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`, or an error if the password, or username/password pair, is invalid. @inlinable public func auth(username: String? = nil, password: String) async throws -> RESPToken { try await send(command: AUTH(username: username, password: password)) @@ -622,11 +621,11 @@ extension RedisConnection { /// Instructs the server whether to track the keys in the next request. /// - /// - Documentation: [CLIENT CACHING](https:/redis.io/docs/latest/commands/client-caching) + /// - Documentation: [CLIENT CACHING](https:/valkey.io/commands/client-caching) /// - Version: 6.0.0 /// - Complexity: O(1) /// - Categories: @slow, @connection - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` or an error if the argument is not "yes" or "no". + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` or an error if the argument is not "yes" or "no". @inlinable public func clientCaching(mode: CLIENT.CACHING.Mode) async throws -> RESPToken { try await send(command: CLIENT.CACHING(mode: mode)) @@ -634,13 +633,13 @@ extension RedisConnection { /// Returns the name of the connection. /// - /// - Documentation: [CLIENT GETNAME](https:/redis.io/docs/latest/commands/client-getname) + /// - Documentation: [CLIENT GETNAME](https:/valkey.io/commands/client-getname) /// - Version: 2.6.9 /// - Complexity: O(1) /// - Categories: @slow, @connection /// - Returns: One of the following: - /// * [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): the connection name of the current connection. - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): the connection name was not set. + /// * [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): the connection name of the current connection. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): the connection name was not set. @inlinable public func clientGetname() async throws -> String? { try await send(command: CLIENT.GETNAME()) @@ -648,14 +647,14 @@ extension RedisConnection { /// Returns the client ID to which the connection's tracking notifications are redirected. /// - /// - Documentation: [CLIENT GETREDIR](https:/redis.io/docs/latest/commands/client-getredir) + /// - Documentation: [CLIENT GETREDIR](https:/valkey.io/commands/client-getredir) /// - Version: 6.0.0 /// - Complexity: O(1) /// - Categories: @slow, @connection /// - Returns: One of the following: - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `0` when not redirecting notifications to any client. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `-1` if client tracking is not enabled. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the ID of the client to which notification are being redirected. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `0` when not redirecting notifications to any client. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `-1` if client tracking is not enabled. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): the ID of the client to which notification are being redirected. @inlinable public func clientGetredir() async throws -> Int { try await send(command: CLIENT.GETREDIR()) @@ -663,11 +662,11 @@ extension RedisConnection { /// Returns helpful text about the different subcommands. /// - /// - Documentation: [CLIENT HELP](https:/redis.io/docs/latest/commands/client-help) + /// - Documentation: [CLIENT HELP](https:/valkey.io/commands/client-help) /// - Version: 5.0.0 /// - Complexity: O(1) /// - Categories: @slow, @connection - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of subcommands and their descriptions. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of subcommands and their descriptions. @inlinable public func clientHelp() async throws -> [RESPToken] { try await send(command: CLIENT.HELP()) @@ -675,11 +674,11 @@ extension RedisConnection { /// Returns the unique client ID of the connection. /// - /// - Documentation: [CLIENT ID](https:/redis.io/docs/latest/commands/client-id) + /// - Documentation: [CLIENT ID](https:/valkey.io/commands/client-id) /// - Version: 5.0.0 /// - Complexity: O(1) /// - Categories: @slow, @connection - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the ID of the client. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the ID of the client. @inlinable public func clientId() async throws -> Int { try await send(command: CLIENT.ID()) @@ -687,11 +686,11 @@ extension RedisConnection { /// Returns information about the connection. /// - /// - Documentation: [CLIENT INFO](https:/redis.io/docs/latest/commands/client-info) + /// - Documentation: [CLIENT INFO](https:/valkey.io/commands/client-info) /// - Version: 6.2.0 /// - Complexity: O(1) /// - Categories: @slow, @connection - /// - Returns: [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): a unique string for the current client, as described at the `CLIENT LIST` page. + /// - Returns: [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): a unique string for the current client, as described at the `CLIENT LIST` page. @inlinable public func clientInfo() async throws -> String { try await send(command: CLIENT.INFO()) @@ -699,13 +698,13 @@ extension RedisConnection { /// Terminates open connections. /// - /// - Documentation: [CLIENT KILL](https:/redis.io/docs/latest/commands/client-kill) + /// - Documentation: [CLIENT KILL](https:/valkey.io/commands/client-kill) /// - Version: 2.4.0 /// - Complexity: O(N) where N is the number of client connections /// - Categories: @admin, @slow, @dangerous, @connection /// - Returns: One of the following: - /// * [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` when called in 3 argument format and the connection has been closed. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): when called in filter/value format, the number of clients killed. + /// * [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` when called in 3 argument format and the connection has been closed. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): when called in filter/value format, the number of clients killed. @inlinable public func clientKill(filter: CLIENT.KILL.Filter) async throws -> Int? { try await send(command: CLIENT.KILL(filter: filter)) @@ -713,11 +712,11 @@ extension RedisConnection { /// Lists open connections. /// - /// - Documentation: [CLIENT LIST](https:/redis.io/docs/latest/commands/client-list) + /// - Documentation: [CLIENT LIST](https:/valkey.io/commands/client-list) /// - Version: 2.4.0 /// - Complexity: O(N) where N is the number of client connections /// - Categories: @admin, @slow, @dangerous, @connection - /// - Returns: [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): information and statistics about client connections. + /// - Returns: [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): information and statistics about client connections. @inlinable public func clientList(clientType: CLIENT.LIST.ClientType? = nil, clientId: [Int] = []) async throws -> String { try await send(command: CLIENT.LIST(clientType: clientType, clientId: clientId)) @@ -725,11 +724,11 @@ extension RedisConnection { /// Sets the client eviction mode of the connection. /// - /// - Documentation: [CLIENT NO-EVICT](https:/redis.io/docs/latest/commands/client-no-evict) + /// - Documentation: [CLIENT NO-EVICT](https:/valkey.io/commands/client-no-evict) /// - Version: 7.0.0 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous, @connection - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func clientNoEvict(enabled: CLIENT.NOEVICT.Enabled) async throws -> RESPToken { try await send(command: CLIENT.NOEVICT(enabled: enabled)) @@ -737,11 +736,11 @@ extension RedisConnection { /// Controls whether commands sent by the client affect the LRU/LFU of accessed keys. /// - /// - Documentation: [CLIENT NO-TOUCH](https:/redis.io/docs/latest/commands/client-no-touch) + /// - Documentation: [CLIENT NO-TOUCH](https:/valkey.io/commands/client-no-touch) /// - Version: 7.2.0 /// - Complexity: O(1) /// - Categories: @slow, @connection - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func clientNoTouch(enabled: CLIENT.NOTOUCH.Enabled) async throws -> RESPToken { try await send(command: CLIENT.NOTOUCH(enabled: enabled)) @@ -749,11 +748,11 @@ extension RedisConnection { /// Suspends commands processing. /// - /// - Documentation: [CLIENT PAUSE](https:/redis.io/docs/latest/commands/client-pause) + /// - Documentation: [CLIENT PAUSE](https:/valkey.io/commands/client-pause) /// - Version: 3.0.0 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous, @connection - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` or an error if the timeout is invalid. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` or an error if the timeout is invalid. @inlinable public func clientPause(timeout: Int, mode: CLIENT.PAUSE.Mode? = nil) async throws -> RESPToken { try await send(command: CLIENT.PAUSE(timeout: timeout, mode: mode)) @@ -761,11 +760,11 @@ extension RedisConnection { /// Instructs the server whether to reply to commands. /// - /// - Documentation: [CLIENT REPLY](https:/redis.io/docs/latest/commands/client-reply) + /// - Documentation: [CLIENT REPLY](https:/valkey.io/commands/client-reply) /// - Version: 3.2.0 /// - Complexity: O(1) /// - Categories: @slow, @connection - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` when called with `ON`. When called with either `OFF` or `SKIP` sub-commands, no reply is made. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` when called with `ON`. When called with either `OFF` or `SKIP` sub-commands, no reply is made. @inlinable public func clientReply(action: CLIENT.REPLY.Action) async throws -> RESPToken { try await send(command: CLIENT.REPLY(action: action)) @@ -773,11 +772,11 @@ extension RedisConnection { /// Sets information specific to the client or connection. /// - /// - Documentation: [CLIENT SETINFO](https:/redis.io/docs/latest/commands/client-setinfo) + /// - Documentation: [CLIENT SETINFO](https:/valkey.io/commands/client-setinfo) /// - Version: 7.2.0 /// - Complexity: O(1) /// - Categories: @slow, @connection - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` if the attribute name was successfully set. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` if the attribute name was successfully set. @inlinable public func clientSetinfo(attr: CLIENT.SETINFO.Attr) async throws -> RESPToken { try await send(command: CLIENT.SETINFO(attr: attr)) @@ -785,11 +784,11 @@ extension RedisConnection { /// Sets the connection name. /// - /// - Documentation: [CLIENT SETNAME](https:/redis.io/docs/latest/commands/client-setname) + /// - Documentation: [CLIENT SETNAME](https:/valkey.io/commands/client-setname) /// - Version: 2.6.9 /// - Complexity: O(1) /// - Categories: @slow, @connection - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` if the connection name was successfully set. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` if the connection name was successfully set. @inlinable public func clientSetname(connectionName: String) async throws -> RESPToken { try await send(command: CLIENT.SETNAME(connectionName: connectionName)) @@ -797,11 +796,11 @@ extension RedisConnection { /// Controls server-assisted client-side caching for the connection. /// - /// - Documentation: [CLIENT TRACKING](https:/redis.io/docs/latest/commands/client-tracking) + /// - Documentation: [CLIENT TRACKING](https:/valkey.io/commands/client-tracking) /// - Version: 6.0.0 /// - Complexity: O(1). Some options may introduce additional complexity. /// - Categories: @slow, @connection - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` if the connection was successfully put in tracking mode or if the tracking mode was successfully disabled. Otherwise, an error is returned. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` if the connection was successfully put in tracking mode or if the tracking mode was successfully disabled. Otherwise, an error is returned. @inlinable public func clientTracking(status: CLIENT.TRACKING.Status, clientId: Int? = nil, prefix: [String] = [], bcast: Bool = false, optin: Bool = false, optout: Bool = false, noloop: Bool = false) async throws -> RESPToken { try await send(command: CLIENT.TRACKING(status: status, clientId: clientId, prefix: prefix, bcast: bcast, optin: optin, optout: optout, noloop: noloop)) @@ -809,11 +808,11 @@ extension RedisConnection { /// Returns information about server-assisted client-side caching for the connection. /// - /// - Documentation: [CLIENT TRACKINGINFO](https:/redis.io/docs/latest/commands/client-trackinginfo) + /// - Documentation: [CLIENT TRACKINGINFO](https:/valkey.io/commands/client-trackinginfo) /// - Version: 6.2.0 /// - Complexity: O(1) /// - Categories: @slow, @connection - /// - Returns: [Map](https:/redis.io/docs/reference/protocol-spec#maps): a list of tracking information sections and their respective values. + /// - Returns: [Map](https:/valkey.io/topics/protocol/#maps): a list of tracking information sections and their respective values. @inlinable public func clientTrackinginfo() async throws -> [String: RESPToken] { try await send(command: CLIENT.TRACKINGINFO()) @@ -821,13 +820,13 @@ extension RedisConnection { /// Unblocks a client blocked by a blocking command from a different connection. /// - /// - Documentation: [CLIENT UNBLOCK](https:/redis.io/docs/latest/commands/client-unblock) + /// - Documentation: [CLIENT UNBLOCK](https:/valkey.io/commands/client-unblock) /// - Version: 5.0.0 /// - Complexity: O(log N) where N is the number of client connections /// - Categories: @admin, @slow, @dangerous, @connection /// - Returns: One of the following: - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `0` if the client was unblocked successfully. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `1` if the client wasn't unblocked. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `0` if the client was unblocked successfully. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `1` if the client wasn't unblocked. @inlinable public func clientUnblock(clientId: Int, unblockType: CLIENT.UNBLOCK.UnblockType? = nil) async throws -> Int { try await send(command: CLIENT.UNBLOCK(clientId: clientId, unblockType: unblockType)) @@ -835,11 +834,11 @@ extension RedisConnection { /// Resumes processing commands from paused clients. /// - /// - Documentation: [CLIENT UNPAUSE](https:/redis.io/docs/latest/commands/client-unpause) + /// - Documentation: [CLIENT UNPAUSE](https:/valkey.io/commands/client-unpause) /// - Version: 6.2.0 /// - Complexity: O(N) Where N is the number of paused clients /// - Categories: @admin, @slow, @dangerous, @connection - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func clientUnpause() async throws -> RESPToken { try await send(command: CLIENT.UNPAUSE()) @@ -847,24 +846,24 @@ extension RedisConnection { /// Returns the given string. /// - /// - Documentation: [ECHO](https:/redis.io/docs/latest/commands/echo) + /// - Documentation: [ECHO](https:/valkey.io/commands/echo) /// - Version: 1.0.0 /// - Complexity: O(1) /// - Categories: @fast, @connection - /// - Returns: [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): the given string. + /// - Returns: [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): the given string. @inlinable public func echo(message: String) async throws -> String { try await send(command: ECHO(message: message)) } - /// Handshakes with the Redis server. + /// Handshakes with the Valkey server. /// - /// - Documentation: [HELLO](https:/redis.io/docs/latest/commands/hello) + /// - Documentation: [HELLO](https:/valkey.io/commands/hello) /// - Version: 6.0.0 /// - Complexity: O(1) /// - Categories: @fast, @connection - /// - Returns: [Map](https:/redis.io/docs/reference/protocol-spec#maps): a list of server properties. - /// [Simple error](https:/redis.io/docs/reference/protocol-spec#simple-errors): if the `protover` requested does not exist. + /// - Returns: [Map](https:/valkey.io/topics/protocol/#maps): a list of server properties. + /// [Simple error](https:/valkey.io/topics/protocol/#simple-errors): if the `protover` requested does not exist. @inlinable public func hello(arguments: HELLO.Arguments? = nil) async throws -> [String: RESPToken] { try await send(command: HELLO(arguments: arguments)) @@ -872,13 +871,13 @@ extension RedisConnection { /// Returns the server's liveliness response. /// - /// - Documentation: [PING](https:/redis.io/docs/latest/commands/ping) + /// - Documentation: [PING](https:/valkey.io/commands/ping) /// - Version: 1.0.0 /// - Complexity: O(1) /// - Categories: @fast, @connection /// - Returns: Any of the following: - /// * [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `PONG` when no argument is provided. - /// * [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): the provided argument. + /// * [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `PONG` when no argument is provided. + /// * [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): the provided argument. @inlinable public func ping(message: String? = nil) async throws -> String { try await send(command: PING(message: message)) @@ -886,11 +885,11 @@ extension RedisConnection { /// Closes the connection. /// - /// - Documentation: [QUIT](https:/redis.io/docs/latest/commands/quit) + /// - Documentation: [QUIT](https:/valkey.io/commands/quit) /// - Version: 1.0.0 /// - Complexity: O(1) /// - Categories: @fast, @connection - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func quit() async throws -> RESPToken { try await send(command: QUIT()) @@ -898,11 +897,11 @@ extension RedisConnection { /// Resets the connection. /// - /// - Documentation: [RESET](https:/redis.io/docs/latest/commands/reset) + /// - Documentation: [RESET](https:/valkey.io/commands/reset) /// - Version: 6.2.0 /// - Complexity: O(1) /// - Categories: @fast, @connection - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `RESET`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `RESET`. @inlinable public func reset() async throws -> String { try await send(command: RESET()) @@ -910,11 +909,11 @@ extension RedisConnection { /// Changes the selected database. /// - /// - Documentation: [SELECT](https:/redis.io/docs/latest/commands/select) + /// - Documentation: [SELECT](https:/valkey.io/commands/select) /// - Version: 1.0.0 /// - Complexity: O(1) /// - Categories: @fast, @connection - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func select(index: Int) async throws -> RESPToken { try await send(command: SELECT(index: index)) diff --git a/Sources/RedisCommands/GenericCommands.swift b/Sources/Valkey/Commands/GenericCommands.swift similarity index 55% rename from Sources/RedisCommands/GenericCommands.swift rename to Sources/Valkey/Commands/GenericCommands.swift index 4fb077cf..0b5c0bb8 100644 --- a/Sources/RedisCommands/GenericCommands.swift +++ b/Sources/Valkey/Commands/GenericCommands.swift @@ -1,21 +1,20 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -// This file is autogenerated by RedisCommandsBuilder +// This file is autogenerated by ValkeyCommandsBuilder import NIOCore -import Redis #if canImport(FoundationEssentials) import FoundationEssentials @@ -25,75 +24,75 @@ import Foundation /// A container for object introspection commands. public enum OBJECT { - /// Returns the internal encoding of a Redis object. - public struct ENCODING: RedisCommand { + /// Returns the internal encoding of a Valkey object. + public struct ENCODING: RESPCommand { public typealias Response = String? - public var key: RedisKey + public var key: RESPKey - @inlinable public init(key: RedisKey) { + @inlinable public init(key: RESPKey) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("OBJECT", "ENCODING", key) } } - /// Returns the logarithmic access frequency counter of a Redis object. - public struct FREQ: RedisCommand { + /// Returns the logarithmic access frequency counter of a Valkey object. + public struct FREQ: RESPCommand { public typealias Response = Int? - public var key: RedisKey + public var key: RESPKey - @inlinable public init(key: RedisKey) { + @inlinable public init(key: RESPKey) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("OBJECT", "FREQ", key) } } /// Returns helpful text about the different subcommands. - public struct HELP: RedisCommand { + public struct HELP: RESPCommand { public typealias Response = [RESPToken] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("OBJECT", "HELP") } } - /// Returns the time since the last access to a Redis object. - public struct IDLETIME: RedisCommand { + /// Returns the time since the last access to a Valkey object. + public struct IDLETIME: RESPCommand { public typealias Response = Int? - public var key: RedisKey + public var key: RESPKey - @inlinable public init(key: RedisKey) { + @inlinable public init(key: RESPKey) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("OBJECT", "IDLETIME", key) } } /// Returns the reference count of a value of a key. - public struct REFCOUNT: RedisCommand { + public struct REFCOUNT: RESPCommand { public typealias Response = Int? - public var key: RedisKey + public var key: RESPKey - @inlinable public init(key: RedisKey) { + @inlinable public init(key: RESPKey) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("OBJECT", "REFCOUNT", key) } } @@ -101,73 +100,73 @@ public enum OBJECT { } /// Copies the value of a key to a new key. -public struct COPY: RedisCommand { +public struct COPY: RESPCommand { public typealias Response = Int - public var source: RedisKey - public var destination: RedisKey + public var source: RESPKey + public var destination: RESPKey public var destinationDb: Int? = nil public var replace: Bool = false - @inlinable public init(source: RedisKey, destination: RedisKey, destinationDb: Int? = nil, replace: Bool = false) { + @inlinable public init(source: RESPKey, destination: RESPKey, destinationDb: Int? = nil, replace: Bool = false) { self.source = source self.destination = destination self.destinationDb = destinationDb self.replace = replace } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("COPY", source, destination, RESPWithToken("DB", destinationDb), RedisPureToken("REPLACE", replace)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("COPY", source, destination, RESPWithToken("DB", destinationDb), RESPPureToken("REPLACE", replace)) } } /// Deletes one or more keys. -public struct DEL: RedisCommand { +public struct DEL: RESPCommand { public typealias Response = Int - public var key: [RedisKey] + public var key: [RESPKey] - @inlinable public init(key: [RedisKey]) { + @inlinable public init(key: [RESPKey]) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("DEL", key) } } /// Returns a serialized representation of the value stored at a key. -public struct DUMP: RedisCommand { +public struct DUMP: RESPCommand { public typealias Response = String? - public var key: RedisKey + public var key: RESPKey - @inlinable public init(key: RedisKey) { + @inlinable public init(key: RESPKey) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("DUMP", key) } } /// Determines whether one or more keys exist. -public struct EXISTS: RedisCommand { +public struct EXISTS: RESPCommand { public typealias Response = Int - public var key: [RedisKey] + public var key: [RESPKey] - @inlinable public init(key: [RedisKey]) { + @inlinable public init(key: [RESPKey]) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("EXISTS", key) } } /// Sets the expiration time of a key in seconds. -public struct EXPIRE: RedisCommand { +public struct EXPIRE: RESPCommand { public enum Condition: RESPRenderable { case nx case xx @@ -175,7 +174,7 @@ public struct EXPIRE: RedisCommand { case lt @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .nx: "NX".encode(into: &commandEncoder) case .xx: "XX".encode(into: &commandEncoder) @@ -186,23 +185,23 @@ public struct EXPIRE: RedisCommand { } public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var seconds: Int public var condition: Condition? = nil - @inlinable public init(key: RedisKey, seconds: Int, condition: Condition? = nil) { + @inlinable public init(key: RESPKey, seconds: Int, condition: Condition? = nil) { self.key = key self.seconds = seconds self.condition = condition } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("EXPIRE", key, seconds, condition) } } /// Sets the expiration time of a key to a Unix timestamp. -public struct EXPIREAT: RedisCommand { +public struct EXPIREAT: RESPCommand { public enum Condition: RESPRenderable { case nx case xx @@ -210,7 +209,7 @@ public struct EXPIREAT: RedisCommand { case lt @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .nx: "NX".encode(into: &commandEncoder) case .xx: "XX".encode(into: &commandEncoder) @@ -221,38 +220,38 @@ public struct EXPIREAT: RedisCommand { } public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var unixTimeSeconds: Date public var condition: Condition? = nil - @inlinable public init(key: RedisKey, unixTimeSeconds: Date, condition: Condition? = nil) { + @inlinable public init(key: RESPKey, unixTimeSeconds: Date, condition: Condition? = nil) { self.key = key self.unixTimeSeconds = unixTimeSeconds self.condition = condition } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("EXPIREAT", key, Int(unixTimeSeconds.timeIntervalSince1970), condition) } } /// Returns the expiration time of a key as a Unix timestamp. -public struct EXPIRETIME: RedisCommand { +public struct EXPIRETIME: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey - @inlinable public init(key: RedisKey) { + @inlinable public init(key: RESPKey) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("EXPIRETIME", key) } } /// Returns all key names that match a pattern. -public struct KEYS: RedisCommand { +public struct KEYS: RESPCommand { public typealias Response = [RESPToken] public var pattern: String @@ -261,19 +260,19 @@ public struct KEYS: RedisCommand { self.pattern = pattern } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("KEYS", pattern) } } -/// Atomically transfers a key from one Redis instance to another. -public struct MIGRATE: RedisCommand { +/// Atomically transfers a key from one Valkey instance to another. +public struct MIGRATE: RESPCommand { public enum KeySelector: RESPRenderable { - case key(RedisKey) + case key(RESPKey) case emptyString @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .key(let key): key.encode(into: &commandEncoder) case .emptyString: "".encode(into: &commandEncoder) @@ -285,7 +284,7 @@ public struct MIGRATE: RedisCommand { @usableFromInline let password: String @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += username.encode(into: &commandEncoder) count += password.encode(into: &commandEncoder) @@ -297,7 +296,7 @@ public struct MIGRATE: RedisCommand { case auth2(AuthenticationAuth2) @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .auth(let auth): RESPWithToken("AUTH", auth).encode(into: &commandEncoder) case .auth2(let auth2): RESPWithToken("AUTH2", auth2).encode(into: &commandEncoder) @@ -314,9 +313,9 @@ public struct MIGRATE: RedisCommand { public var copy: Bool = false public var replace: Bool = false public var authentication: Authentication? = nil - public var keys: [RedisKey] = [] + public var keys: [RESPKey] = [] - @inlinable public init(host: String, port: Int, keySelector: KeySelector, destinationDb: Int, timeout: Int, copy: Bool = false, replace: Bool = false, authentication: Authentication? = nil, keys: [RedisKey] = []) { + @inlinable public init(host: String, port: Int, keySelector: KeySelector, destinationDb: Int, timeout: Int, copy: Bool = false, replace: Bool = false, authentication: Authentication? = nil, keys: [RESPKey] = []) { self.host = host self.port = port self.keySelector = keySelector @@ -328,45 +327,45 @@ public struct MIGRATE: RedisCommand { self.keys = keys } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("MIGRATE", host, port, keySelector, destinationDb, timeout, RedisPureToken("COPY", copy), RedisPureToken("REPLACE", replace), authentication, RESPWithToken("KEYS", keys)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("MIGRATE", host, port, keySelector, destinationDb, timeout, RESPPureToken("COPY", copy), RESPPureToken("REPLACE", replace), authentication, RESPWithToken("KEYS", keys)) } } /// Moves a key to another database. -public struct MOVE: RedisCommand { +public struct MOVE: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var db: Int - @inlinable public init(key: RedisKey, db: Int) { + @inlinable public init(key: RESPKey, db: Int) { self.key = key self.db = db } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("MOVE", key, db) } } /// Removes the expiration time of a key. -public struct PERSIST: RedisCommand { +public struct PERSIST: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey - @inlinable public init(key: RedisKey) { + @inlinable public init(key: RESPKey) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("PERSIST", key) } } /// Sets the expiration time of a key in milliseconds. -public struct PEXPIRE: RedisCommand { +public struct PEXPIRE: RESPCommand { public enum Condition: RESPRenderable { case nx case xx @@ -374,7 +373,7 @@ public struct PEXPIRE: RedisCommand { case lt @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .nx: "NX".encode(into: &commandEncoder) case .xx: "XX".encode(into: &commandEncoder) @@ -385,23 +384,23 @@ public struct PEXPIRE: RedisCommand { } public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var milliseconds: Int public var condition: Condition? = nil - @inlinable public init(key: RedisKey, milliseconds: Int, condition: Condition? = nil) { + @inlinable public init(key: RESPKey, milliseconds: Int, condition: Condition? = nil) { self.key = key self.milliseconds = milliseconds self.condition = condition } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("PEXPIRE", key, milliseconds, condition) } } /// Sets the expiration time of a key to a Unix milliseconds timestamp. -public struct PEXPIREAT: RedisCommand { +public struct PEXPIREAT: RESPCommand { public enum Condition: RESPRenderable { case nx case xx @@ -409,7 +408,7 @@ public struct PEXPIREAT: RedisCommand { case lt @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .nx: "NX".encode(into: &commandEncoder) case .xx: "XX".encode(into: &commandEncoder) @@ -420,103 +419,103 @@ public struct PEXPIREAT: RedisCommand { } public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var unixTimeMilliseconds: Date public var condition: Condition? = nil - @inlinable public init(key: RedisKey, unixTimeMilliseconds: Date, condition: Condition? = nil) { + @inlinable public init(key: RESPKey, unixTimeMilliseconds: Date, condition: Condition? = nil) { self.key = key self.unixTimeMilliseconds = unixTimeMilliseconds self.condition = condition } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("PEXPIREAT", key, Int(unixTimeMilliseconds.timeIntervalSince1970 * 1000), condition) } } /// Returns the expiration time of a key as a Unix milliseconds timestamp. -public struct PEXPIRETIME: RedisCommand { +public struct PEXPIRETIME: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey - @inlinable public init(key: RedisKey) { + @inlinable public init(key: RESPKey) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("PEXPIRETIME", key) } } /// Returns the expiration time in milliseconds of a key. -public struct PTTL: RedisCommand { +public struct PTTL: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey - @inlinable public init(key: RedisKey) { + @inlinable public init(key: RESPKey) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("PTTL", key) } } /// Returns a random key name from the database. -public struct RANDOMKEY: RedisCommand { +public struct RANDOMKEY: RESPCommand { public typealias Response = String? @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("RANDOMKEY") } } /// Renames a key and overwrites the destination. -public struct RENAME: RedisCommand { +public struct RENAME: RESPCommand { public typealias Response = RESPToken - public var key: RedisKey - public var newkey: RedisKey + public var key: RESPKey + public var newkey: RESPKey - @inlinable public init(key: RedisKey, newkey: RedisKey) { + @inlinable public init(key: RESPKey, newkey: RESPKey) { self.key = key self.newkey = newkey } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("RENAME", key, newkey) } } /// Renames a key only when the target key name doesn't exist. -public struct RENAMENX: RedisCommand { +public struct RENAMENX: RESPCommand { public typealias Response = Int - public var key: RedisKey - public var newkey: RedisKey + public var key: RESPKey + public var newkey: RESPKey - @inlinable public init(key: RedisKey, newkey: RedisKey) { + @inlinable public init(key: RESPKey, newkey: RESPKey) { self.key = key self.newkey = newkey } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("RENAMENX", key, newkey) } } /// Creates a key from the serialized representation of a value. -public struct RESTORE: RedisCommand { +public struct RESTORE: RESPCommand { public typealias Response = RESPToken - public var key: RedisKey + public var key: RESPKey public var ttl: Int public var serializedValue: String public var replace: Bool = false @@ -524,7 +523,7 @@ public struct RESTORE: RedisCommand { public var seconds: Int? = nil public var frequency: Int? = nil - @inlinable public init(key: RedisKey, ttl: Int, serializedValue: String, replace: Bool = false, absttl: Bool = false, seconds: Int? = nil, frequency: Int? = nil) { + @inlinable public init(key: RESPKey, ttl: Int, serializedValue: String, replace: Bool = false, absttl: Bool = false, seconds: Int? = nil, frequency: Int? = nil) { self.key = key self.ttl = ttl self.serializedValue = serializedValue @@ -534,13 +533,13 @@ public struct RESTORE: RedisCommand { self.frequency = frequency } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("RESTORE", key, ttl, serializedValue, RedisPureToken("REPLACE", replace), RedisPureToken("ABSTTL", absttl), RESPWithToken("IDLETIME", seconds), RESPWithToken("FREQ", frequency)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("RESTORE", key, ttl, serializedValue, RESPPureToken("REPLACE", replace), RESPPureToken("ABSTTL", absttl), RESPWithToken("IDLETIME", seconds), RESPWithToken("FREQ", frequency)) } } /// Iterates over the key names in the database. -public struct SCAN: RedisCommand { +public struct SCAN: RESPCommand { public typealias Response = [RESPToken] public var cursor: Int @@ -555,19 +554,19 @@ public struct SCAN: RedisCommand { self.type = type } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("SCAN", cursor, RESPWithToken("MATCH", pattern), RESPWithToken("COUNT", count), RESPWithToken("TYPE", type)) } } /// Sorts the elements in a list, a set, or a sorted set, optionally storing the result. -public struct SORT: RedisCommand { +public struct SORT: RESPCommand { public struct Limit: RESPRenderable { @usableFromInline let offset: Int @usableFromInline let count: Int @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += offset.encode(into: &commandEncoder) count += count.encode(into: &commandEncoder) @@ -579,7 +578,7 @@ public struct SORT: RedisCommand { case desc @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .asc: "ASC".encode(into: &commandEncoder) case .desc: "DESC".encode(into: &commandEncoder) @@ -588,15 +587,15 @@ public struct SORT: RedisCommand { } public typealias Response = RESPToken - public var key: RedisKey + public var key: RESPKey public var byPattern: String? = nil public var limit: Limit? = nil public var getPattern: [String] = [] public var order: Order? = nil public var sorting: Bool = false - public var destination: RedisKey? = nil + public var destination: RESPKey? = nil - @inlinable public init(key: RedisKey, byPattern: String? = nil, limit: Limit? = nil, getPattern: [String] = [], order: Order? = nil, sorting: Bool = false, destination: RedisKey? = nil) { + @inlinable public init(key: RESPKey, byPattern: String? = nil, limit: Limit? = nil, getPattern: [String] = [], order: Order? = nil, sorting: Bool = false, destination: RESPKey? = nil) { self.key = key self.byPattern = byPattern self.limit = limit @@ -606,19 +605,19 @@ public struct SORT: RedisCommand { self.destination = destination } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("SORT", key, RESPWithToken("BY", byPattern), RESPWithToken("LIMIT", limit), RESPWithToken("GET", getPattern), order, RedisPureToken("ALPHA", sorting), RESPWithToken("STORE", destination)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("SORT", key, RESPWithToken("BY", byPattern), RESPWithToken("LIMIT", limit), RESPWithToken("GET", getPattern), order, RESPPureToken("ALPHA", sorting), RESPWithToken("STORE", destination)) } } /// Returns the sorted elements of a list, a set, or a sorted set. -public struct SORTRO: RedisCommand { +public struct SORTRO: RESPCommand { public struct Limit: RESPRenderable { @usableFromInline let offset: Int @usableFromInline let count: Int @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += offset.encode(into: &commandEncoder) count += count.encode(into: &commandEncoder) @@ -630,7 +629,7 @@ public struct SORTRO: RedisCommand { case desc @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .asc: "ASC".encode(into: &commandEncoder) case .desc: "DESC".encode(into: &commandEncoder) @@ -639,14 +638,14 @@ public struct SORTRO: RedisCommand { } public typealias Response = [RESPToken] - public var key: RedisKey + public var key: RESPKey public var byPattern: String? = nil public var limit: Limit? = nil public var getPattern: [String] = [] public var order: Order? = nil public var sorting: Bool = false - @inlinable public init(key: RedisKey, byPattern: String? = nil, limit: Limit? = nil, getPattern: [String] = [], order: Order? = nil, sorting: Bool = false) { + @inlinable public init(key: RESPKey, byPattern: String? = nil, limit: Limit? = nil, getPattern: [String] = [], order: Order? = nil, sorting: Bool = false) { self.key = key self.byPattern = byPattern self.limit = limit @@ -655,73 +654,73 @@ public struct SORTRO: RedisCommand { self.sorting = sorting } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("SORT_RO", key, RESPWithToken("BY", byPattern), RESPWithToken("LIMIT", limit), RESPWithToken("GET", getPattern), order, RedisPureToken("ALPHA", sorting)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("SORT_RO", key, RESPWithToken("BY", byPattern), RESPWithToken("LIMIT", limit), RESPWithToken("GET", getPattern), order, RESPPureToken("ALPHA", sorting)) } } /// Returns the number of existing keys out of those specified after updating the time they were last accessed. -public struct TOUCH: RedisCommand { +public struct TOUCH: RESPCommand { public typealias Response = Int - public var key: [RedisKey] + public var key: [RESPKey] - @inlinable public init(key: [RedisKey]) { + @inlinable public init(key: [RESPKey]) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("TOUCH", key) } } /// Returns the expiration time in seconds of a key. -public struct TTL: RedisCommand { +public struct TTL: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey - @inlinable public init(key: RedisKey) { + @inlinable public init(key: RESPKey) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("TTL", key) } } /// Determines the type of value stored at a key. -public struct TYPE: RedisCommand { +public struct TYPE: RESPCommand { public typealias Response = String - public var key: RedisKey + public var key: RESPKey - @inlinable public init(key: RedisKey) { + @inlinable public init(key: RESPKey) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("TYPE", key) } } /// Asynchronously deletes one or more keys. -public struct UNLINK: RedisCommand { +public struct UNLINK: RESPCommand { public typealias Response = Int - public var key: [RedisKey] + public var key: [RESPKey] - @inlinable public init(key: [RedisKey]) { + @inlinable public init(key: [RESPKey]) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("UNLINK", key) } } /// Blocks until the asynchronous replication of all preceding write commands sent by the connection is completed. -public struct WAIT: RedisCommand { +public struct WAIT: RESPCommand { public typealias Response = Int public var numreplicas: Int @@ -732,13 +731,13 @@ public struct WAIT: RedisCommand { self.timeout = timeout } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("WAIT", numreplicas, timeout) } } /// Blocks until all of the preceding write commands sent by the connection are written to the append-only file of the master and/or replicas. -public struct WAITAOF: RedisCommand { +public struct WAITAOF: RESPCommand { public typealias Response = [RESPToken] public var numlocal: Int @@ -751,297 +750,297 @@ public struct WAITAOF: RedisCommand { self.timeout = timeout } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("WAITAOF", numlocal, numreplicas, timeout) } } -extension RedisConnection { +extension ValkeyConnection { /// Copies the value of a key to a new key. /// - /// - Documentation: [COPY](https:/redis.io/docs/latest/commands/copy) + /// - Documentation: [COPY](https:/valkey.io/commands/copy) /// - Version: 6.2.0 /// - Complexity: O(N) worst case for collections, where N is the number of nested items. O(1) for string values. /// - Categories: @keyspace, @write, @slow /// - Returns: One of the following: - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `1` if _source_ was copied. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `0` if _source_ was not copied. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `1` if _source_ was copied. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `0` if _source_ was not copied when the destination key already exists. @inlinable - public func copy(source: RedisKey, destination: RedisKey, destinationDb: Int? = nil, replace: Bool = false) async throws -> Int { + public func copy(source: RESPKey, destination: RESPKey, destinationDb: Int? = nil, replace: Bool = false) async throws -> Int { try await send(command: COPY(source: source, destination: destination, destinationDb: destinationDb, replace: replace)) } /// Deletes one or more keys. /// - /// - Documentation: [DEL](https:/redis.io/docs/latest/commands/del) + /// - Documentation: [DEL](https:/valkey.io/commands/del) /// - Version: 1.0.0 /// - Complexity: O(N) where N is the number of keys that will be removed. When a key to remove holds a value other than a string, the individual complexity for this key is O(M) where M is the number of elements in the list, set, sorted set or hash. Removing a single key that holds a string value is O(1). /// - Categories: @keyspace, @write, @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of keys that were removed. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of keys that were removed. @inlinable - public func del(key: [RedisKey]) async throws -> Int { + public func del(key: [RESPKey]) async throws -> Int { try await send(command: DEL(key: key)) } /// Returns a serialized representation of the value stored at a key. /// - /// - Documentation: [DUMP](https:/redis.io/docs/latest/commands/dump) + /// - Documentation: [DUMP](https:/valkey.io/commands/dump) /// - Version: 2.6.0 - /// - Complexity: O(1) to access the key and additional O(N*M) to serialize it, where N is the number of Redis objects composing the value and M their average size. For small string values the time complexity is thus O(1)+O(1*M) where M is small, so simply O(1). + /// - Complexity: O(1) to access the key and additional O(N*M) to serialize it, where N is the number of Valkey objects composing the value and M their average size. For small string values the time complexity is thus O(1)+O(1*M) where M is small, so simply O(1). /// - Categories: @keyspace, @read, @slow /// - Returns: One of the following: - /// * [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): the serialized value of the key. - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): the key does not exist. + /// * [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): the serialized value of the key. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): the key does not exist. @inlinable - public func dump(key: RedisKey) async throws -> String? { + public func dump(key: RESPKey) async throws -> String? { try await send(command: DUMP(key: key)) } /// Determines whether one or more keys exist. /// - /// - Documentation: [EXISTS](https:/redis.io/docs/latest/commands/exists) + /// - Documentation: [EXISTS](https:/valkey.io/commands/exists) /// - Version: 1.0.0 /// - Complexity: O(N) where N is the number of keys to check. /// - Categories: @keyspace, @read, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of keys that exist from those specified as arguments. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of keys that exist from those specified as arguments. @inlinable - public func exists(key: [RedisKey]) async throws -> Int { + public func exists(key: [RESPKey]) async throws -> Int { try await send(command: EXISTS(key: key)) } /// Sets the expiration time of a key in seconds. /// - /// - Documentation: [EXPIRE](https:/redis.io/docs/latest/commands/expire) + /// - Documentation: [EXPIRE](https:/valkey.io/commands/expire) /// - Version: 1.0.0 /// - Complexity: O(1) /// - Categories: @keyspace, @write, @fast /// - Returns: One of the following: - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `0` if the timeout was not set; for example, the key doesn't exist, or the operation was skipped because of the provided arguments. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `1` if the timeout was set. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `0` if the timeout was not set; for example, the key doesn't exist, or the operation was skipped because of the provided arguments. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `1` if the timeout was set. @inlinable - public func expire(key: RedisKey, seconds: Int, condition: EXPIRE.Condition? = nil) async throws -> Int { + public func expire(key: RESPKey, seconds: Int, condition: EXPIRE.Condition? = nil) async throws -> Int { try await send(command: EXPIRE(key: key, seconds: seconds, condition: condition)) } /// Sets the expiration time of a key to a Unix timestamp. /// - /// - Documentation: [EXPIREAT](https:/redis.io/docs/latest/commands/expireat) + /// - Documentation: [EXPIREAT](https:/valkey.io/commands/expireat) /// - Version: 1.2.0 /// - Complexity: O(1) /// - Categories: @keyspace, @write, @fast /// - Returns: One of the following: - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `0` if the timeout was not set; for example, the key doesn't exist, or the operation was skipped because of the provided arguments. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `1` if the timeout was set. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `0` if the timeout was not set; for example, the key doesn't exist, or the operation was skipped because of the provided arguments. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `1` if the timeout was set. @inlinable - public func expireat(key: RedisKey, unixTimeSeconds: Date, condition: EXPIREAT.Condition? = nil) async throws -> Int { + public func expireat(key: RESPKey, unixTimeSeconds: Date, condition: EXPIREAT.Condition? = nil) async throws -> Int { try await send(command: EXPIREAT(key: key, unixTimeSeconds: unixTimeSeconds, condition: condition)) } /// Returns the expiration time of a key as a Unix timestamp. /// - /// - Documentation: [EXPIRETIME](https:/redis.io/docs/latest/commands/expiretime) + /// - Documentation: [EXPIRETIME](https:/valkey.io/commands/expiretime) /// - Version: 7.0.0 /// - Complexity: O(1) /// - Categories: @keyspace, @read, @fast /// - Returns: One of the following: - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the expiration Unix timestamp in seconds. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `-1` if the key exists but has no associated expiration time. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `-2` if the key does not exist. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): the expiration Unix timestamp in seconds. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `-1` if the key exists but has no associated expiration time. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `-2` if the key does not exist. @inlinable - public func expiretime(key: RedisKey) async throws -> Int { + public func expiretime(key: RESPKey) async throws -> Int { try await send(command: EXPIRETIME(key: key)) } /// Returns all key names that match a pattern. /// - /// - Documentation: [KEYS](https:/redis.io/docs/latest/commands/keys) + /// - Documentation: [KEYS](https:/valkey.io/commands/keys) /// - Version: 1.0.0 /// - Complexity: O(N) with N being the number of keys in the database, under the assumption that the key names in the database and the given pattern have limited length. /// - Categories: @keyspace, @read, @slow, @dangerous - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of keys matching _pattern_. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of keys matching _pattern_. @inlinable public func keys(pattern: String) async throws -> [RESPToken] { try await send(command: KEYS(pattern: pattern)) } - /// Atomically transfers a key from one Redis instance to another. + /// Atomically transfers a key from one Valkey instance to another. /// - /// - Documentation: [MIGRATE](https:/redis.io/docs/latest/commands/migrate) + /// - Documentation: [MIGRATE](https:/valkey.io/commands/migrate) /// - Version: 2.6.0 /// - Complexity: This command actually executes a DUMP+DEL in the source instance, and a RESTORE in the target instance. See the pages of these commands for time complexity. Also an O(N) data transfer between the two instances is performed. /// - Categories: @keyspace, @write, @slow, @dangerous /// - Returns: One of the following: - /// * [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` on success. - /// * [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `NOKEY` when no keys were found in the source instance. + /// * [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` on success. + /// * [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `NOKEY` when no keys were found in the source instance. @inlinable - public func migrate(host: String, port: Int, keySelector: MIGRATE.KeySelector, destinationDb: Int, timeout: Int, copy: Bool = false, replace: Bool = false, authentication: MIGRATE.Authentication? = nil, keys: [RedisKey] = []) async throws -> String? { + public func migrate(host: String, port: Int, keySelector: MIGRATE.KeySelector, destinationDb: Int, timeout: Int, copy: Bool = false, replace: Bool = false, authentication: MIGRATE.Authentication? = nil, keys: [RESPKey] = []) async throws -> String? { try await send(command: MIGRATE(host: host, port: port, keySelector: keySelector, destinationDb: destinationDb, timeout: timeout, copy: copy, replace: replace, authentication: authentication, keys: keys)) } /// Moves a key to another database. /// - /// - Documentation: [MOVE](https:/redis.io/docs/latest/commands/move) + /// - Documentation: [MOVE](https:/valkey.io/commands/move) /// - Version: 1.0.0 /// - Complexity: O(1) /// - Categories: @keyspace, @write, @fast /// - Returns: One of the following: - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `1` if _key_ was moved. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `0` if _key_ wasn't moved. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `1` if _key_ was moved. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `0` if _key_ already exists in the destination database, or it does not exist in the source database. @inlinable - public func move(key: RedisKey, db: Int) async throws -> Int { + public func move(key: RESPKey, db: Int) async throws -> Int { try await send(command: MOVE(key: key, db: db)) } - /// Returns the internal encoding of a Redis object. + /// Returns the internal encoding of a Valkey object. /// - /// - Documentation: [OBJECT ENCODING](https:/redis.io/docs/latest/commands/object-encoding) + /// - Documentation: [OBJECT ENCODING](https:/valkey.io/commands/object-encoding) /// - Version: 2.2.3 /// - Complexity: O(1) /// - Categories: @keyspace, @read, @slow /// - Returns: One of the following: - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): if the key doesn't exist. - /// * [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): the encoding of the object. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): if the key doesn't exist. + /// * [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): the encoding of the object. @inlinable - public func objectEncoding(key: RedisKey) async throws -> String? { + public func objectEncoding(key: RESPKey) async throws -> String? { try await send(command: OBJECT.ENCODING(key: key)) } - /// Returns the logarithmic access frequency counter of a Redis object. + /// Returns the logarithmic access frequency counter of a Valkey object. /// - /// - Documentation: [OBJECT FREQ](https:/redis.io/docs/latest/commands/object-freq) + /// - Documentation: [OBJECT FREQ](https:/valkey.io/commands/object-freq) /// - Version: 4.0.0 /// - Complexity: O(1) /// - Categories: @keyspace, @read, @slow /// - Returns: One of the following: - /// [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the counter's value. - /// [Null](https:/redis.io/docs/reference/protocol-spec#nulls): if _key_ doesn't exist. + /// [Integer](https:/valkey.io/topics/protocol/#integers): the counter's value. + /// [Null](https:/valkey.io/topics/protocol/#nulls): if _key_ doesn't exist. @inlinable - public func objectFreq(key: RedisKey) async throws -> Int? { + public func objectFreq(key: RESPKey) async throws -> Int? { try await send(command: OBJECT.FREQ(key: key)) } /// Returns helpful text about the different subcommands. /// - /// - Documentation: [OBJECT HELP](https:/redis.io/docs/latest/commands/object-help) + /// - Documentation: [OBJECT HELP](https:/valkey.io/commands/object-help) /// - Version: 6.2.0 /// - Complexity: O(1) /// - Categories: @keyspace, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of sub-commands and their descriptions. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of sub-commands and their descriptions. @inlinable public func objectHelp() async throws -> [RESPToken] { try await send(command: OBJECT.HELP()) } - /// Returns the time since the last access to a Redis object. + /// Returns the time since the last access to a Valkey object. /// - /// - Documentation: [OBJECT IDLETIME](https:/redis.io/docs/latest/commands/object-idletime) + /// - Documentation: [OBJECT IDLETIME](https:/valkey.io/commands/object-idletime) /// - Version: 2.2.3 /// - Complexity: O(1) /// - Categories: @keyspace, @read, @slow /// - Returns: One of the following: - /// [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the idle time in seconds. - /// [Null](https:/redis.io/docs/reference/protocol-spec#nulls): if _key_ doesn't exist. + /// [Integer](https:/valkey.io/topics/protocol/#integers): the idle time in seconds. + /// [Null](https:/valkey.io/topics/protocol/#nulls): if _key_ doesn't exist. @inlinable - public func objectIdletime(key: RedisKey) async throws -> Int? { + public func objectIdletime(key: RESPKey) async throws -> Int? { try await send(command: OBJECT.IDLETIME(key: key)) } /// Returns the reference count of a value of a key. /// - /// - Documentation: [OBJECT REFCOUNT](https:/redis.io/docs/latest/commands/object-refcount) + /// - Documentation: [OBJECT REFCOUNT](https:/valkey.io/commands/object-refcount) /// - Version: 2.2.3 /// - Complexity: O(1) /// - Categories: @keyspace, @read, @slow /// - Returns: One of the following: - /// [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of references. - /// [Null](https:/redis.io/docs/reference/protocol-spec#nulls): if _key_ doesn't exist. + /// [Integer](https:/valkey.io/topics/protocol/#integers): the number of references. + /// [Null](https:/valkey.io/topics/protocol/#nulls): if _key_ doesn't exist. @inlinable - public func objectRefcount(key: RedisKey) async throws -> Int? { + public func objectRefcount(key: RESPKey) async throws -> Int? { try await send(command: OBJECT.REFCOUNT(key: key)) } /// Removes the expiration time of a key. /// - /// - Documentation: [PERSIST](https:/redis.io/docs/latest/commands/persist) + /// - Documentation: [PERSIST](https:/valkey.io/commands/persist) /// - Version: 2.2.0 /// - Complexity: O(1) /// - Categories: @keyspace, @write, @fast /// - Returns: One of the following: - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `0` if _key_ does not exist or does not have an associated timeout. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `1` if the timeout has been removed. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `0` if _key_ does not exist or does not have an associated timeout. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `1` if the timeout has been removed. @inlinable - public func persist(key: RedisKey) async throws -> Int { + public func persist(key: RESPKey) async throws -> Int { try await send(command: PERSIST(key: key)) } /// Sets the expiration time of a key in milliseconds. /// - /// - Documentation: [PEXPIRE](https:/redis.io/docs/latest/commands/pexpire) + /// - Documentation: [PEXPIRE](https:/valkey.io/commands/pexpire) /// - Version: 2.6.0 /// - Complexity: O(1) /// - Categories: @keyspace, @write, @fast /// - Returns: One of the following: - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `0`if the timeout was not set. For example, if the key doesn't exist, or the operation skipped because of the provided arguments. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `1` if the timeout was set. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `0`if the timeout was not set. For example, if the key doesn't exist, or the operation skipped because of the provided arguments. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `1` if the timeout was set. @inlinable - public func pexpire(key: RedisKey, milliseconds: Int, condition: PEXPIRE.Condition? = nil) async throws -> Int { + public func pexpire(key: RESPKey, milliseconds: Int, condition: PEXPIRE.Condition? = nil) async throws -> Int { try await send(command: PEXPIRE(key: key, milliseconds: milliseconds, condition: condition)) } /// Sets the expiration time of a key to a Unix milliseconds timestamp. /// - /// - Documentation: [PEXPIREAT](https:/redis.io/docs/latest/commands/pexpireat) + /// - Documentation: [PEXPIREAT](https:/valkey.io/commands/pexpireat) /// - Version: 2.6.0 /// - Complexity: O(1) /// - Categories: @keyspace, @write, @fast /// - Returns: One of the following: - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `1` if the timeout was set. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `0` if the timeout was not set. For example, if the key doesn't exist, or the operation was skipped due to the provided arguments. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `1` if the timeout was set. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `0` if the timeout was not set. For example, if the key doesn't exist, or the operation was skipped due to the provided arguments. @inlinable - public func pexpireat(key: RedisKey, unixTimeMilliseconds: Date, condition: PEXPIREAT.Condition? = nil) async throws -> Int { + public func pexpireat(key: RESPKey, unixTimeMilliseconds: Date, condition: PEXPIREAT.Condition? = nil) async throws -> Int { try await send(command: PEXPIREAT(key: key, unixTimeMilliseconds: unixTimeMilliseconds, condition: condition)) } /// Returns the expiration time of a key as a Unix milliseconds timestamp. /// - /// - Documentation: [PEXPIRETIME](https:/redis.io/docs/latest/commands/pexpiretime) + /// - Documentation: [PEXPIRETIME](https:/valkey.io/commands/pexpiretime) /// - Version: 7.0.0 /// - Complexity: O(1) /// - Categories: @keyspace, @read, @fast /// - Returns: One of the following: - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): Expiration Unix timestamp in milliseconds. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `-1` if the key exists but has no associated expiration time. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `-2` if the key does not exist. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): Expiration Unix timestamp in milliseconds. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `-1` if the key exists but has no associated expiration time. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `-2` if the key does not exist. @inlinable - public func pexpiretime(key: RedisKey) async throws -> Int { + public func pexpiretime(key: RESPKey) async throws -> Int { try await send(command: PEXPIRETIME(key: key)) } /// Returns the expiration time in milliseconds of a key. /// - /// - Documentation: [PTTL](https:/redis.io/docs/latest/commands/pttl) + /// - Documentation: [PTTL](https:/valkey.io/commands/pttl) /// - Version: 2.6.0 /// - Complexity: O(1) /// - Categories: @keyspace, @read, @fast /// - Returns: One of the following: - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): TTL in milliseconds. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `-1` if the key exists but has no associated expiration. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `-2` if the key does not exist. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): TTL in milliseconds. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `-1` if the key exists but has no associated expiration. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `-2` if the key does not exist. @inlinable - public func pttl(key: RedisKey) async throws -> Int { + public func pttl(key: RESPKey) async throws -> Int { try await send(command: PTTL(key: key)) } /// Returns a random key name from the database. /// - /// - Documentation: [RANDOMKEY](https:/redis.io/docs/latest/commands/randomkey) + /// - Documentation: [RANDOMKEY](https:/valkey.io/commands/randomkey) /// - Version: 1.0.0 /// - Complexity: O(1) /// - Categories: @keyspace, @read, @slow /// - Returns: One of the following: - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): when the database is empty. - /// * [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): a random key in the database. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): when the database is empty. + /// * [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): a random key in the database. @inlinable public func randomkey() async throws -> String? { try await send(command: RANDOMKEY()) @@ -1049,51 +1048,51 @@ extension RedisConnection { /// Renames a key and overwrites the destination. /// - /// - Documentation: [RENAME](https:/redis.io/docs/latest/commands/rename) + /// - Documentation: [RENAME](https:/valkey.io/commands/rename) /// - Version: 1.0.0 /// - Complexity: O(1) /// - Categories: @keyspace, @write, @slow - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable - public func rename(key: RedisKey, newkey: RedisKey) async throws -> RESPToken { + public func rename(key: RESPKey, newkey: RESPKey) async throws -> RESPToken { try await send(command: RENAME(key: key, newkey: newkey)) } /// Renames a key only when the target key name doesn't exist. /// - /// - Documentation: [RENAMENX](https:/redis.io/docs/latest/commands/renamenx) + /// - Documentation: [RENAMENX](https:/valkey.io/commands/renamenx) /// - Version: 1.0.0 /// - Complexity: O(1) /// - Categories: @keyspace, @write, @fast /// - Returns: One of the following: - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `1` if _key_ was renamed to _newkey_. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `0` if _newkey_ already exists. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `1` if _key_ was renamed to _newkey_. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `0` if _newkey_ already exists. @inlinable - public func renamenx(key: RedisKey, newkey: RedisKey) async throws -> Int { + public func renamenx(key: RESPKey, newkey: RESPKey) async throws -> Int { try await send(command: RENAMENX(key: key, newkey: newkey)) } /// Creates a key from the serialized representation of a value. /// - /// - Documentation: [RESTORE](https:/redis.io/docs/latest/commands/restore) + /// - Documentation: [RESTORE](https:/valkey.io/commands/restore) /// - Version: 2.6.0 - /// - Complexity: O(1) to create the new key and additional O(N*M) to reconstruct the serialized value, where N is the number of Redis objects composing the value and M their average size. For small string values the time complexity is thus O(1)+O(1*M) where M is small, so simply O(1). However for sorted set values the complexity is O(N*M*log(N)) because inserting values into sorted sets is O(log(N)). + /// - Complexity: O(1) to create the new key and additional O(N*M) to reconstruct the serialized value, where N is the number of Valkey objects composing the value and M their average size. For small string values the time complexity is thus O(1)+O(1*M) where M is small, so simply O(1). However for sorted set values the complexity is O(N*M*log(N)) because inserting values into sorted sets is O(log(N)). /// - Categories: @keyspace, @write, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable - public func restore(key: RedisKey, ttl: Int, serializedValue: String, replace: Bool = false, absttl: Bool = false, seconds: Int? = nil, frequency: Int? = nil) async throws -> RESPToken { + public func restore(key: RESPKey, ttl: Int, serializedValue: String, replace: Bool = false, absttl: Bool = false, seconds: Int? = nil, frequency: Int? = nil) async throws -> RESPToken { try await send(command: RESTORE(key: key, ttl: ttl, serializedValue: serializedValue, replace: replace, absttl: absttl, seconds: seconds, frequency: frequency)) } /// Iterates over the key names in the database. /// - /// - Documentation: [SCAN](https:/redis.io/docs/latest/commands/scan) + /// - Documentation: [SCAN](https:/valkey.io/commands/scan) /// - Version: 2.8.0 /// - Complexity: O(1) for every call. O(N) for a complete iteration, including enough command calls for the cursor to return back to 0. N is the number of elements inside the collection. /// - Categories: @keyspace, @read, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): specifically, an array with two elements. - /// * The first element is a [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings) that represents an unsigned 64-bit number, the cursor. - /// * The second element is an [Array](https:/redis.io/docs/reference/protocol-spec#arrays) with the names of scanned keys. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): specifically, an array with two elements. + /// * The first element is a [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings) that represents an unsigned 64-bit number, the cursor. + /// * The second element is an [Array](https:/valkey.io/topics/protocol/#arrays) with the names of scanned keys. @inlinable public func scan(cursor: Int, pattern: String? = nil, count: Int? = nil, type: String? = nil) async throws -> [RESPToken] { try await send(command: SCAN(cursor: cursor, pattern: pattern, count: count, type: type)) @@ -1101,87 +1100,87 @@ extension RedisConnection { /// Sorts the elements in a list, a set, or a sorted set, optionally storing the result. /// - /// - Documentation: [SORT](https:/redis.io/docs/latest/commands/sort) + /// - Documentation: [SORT](https:/valkey.io/commands/sort) /// - Version: 1.0.0 /// - Complexity: O(N+M*log(M)) where N is the number of elements in the list or set to sort, and M the number of returned elements. When the elements are not sorted, complexity is O(N). /// - Categories: @write, @set, @sortedset, @list, @slow, @dangerous - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): without passing the _STORE_ option, the command returns a list of sorted elements. - /// [Integer](https:/redis.io/docs/reference/protocol-spec#integers): when the _STORE_ option is specified, the command returns the number of sorted elements in the destination list. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): without passing the _STORE_ option, the command returns a list of sorted elements. + /// [Integer](https:/valkey.io/topics/protocol/#integers): when the _STORE_ option is specified, the command returns the number of sorted elements in the destination list. @inlinable - public func sort(key: RedisKey, byPattern: String? = nil, limit: SORT.Limit? = nil, getPattern: [String] = [], order: SORT.Order? = nil, sorting: Bool = false, destination: RedisKey? = nil) async throws -> RESPToken { + public func sort(key: RESPKey, byPattern: String? = nil, limit: SORT.Limit? = nil, getPattern: [String] = [], order: SORT.Order? = nil, sorting: Bool = false, destination: RESPKey? = nil) async throws -> RESPToken { try await send(command: SORT(key: key, byPattern: byPattern, limit: limit, getPattern: getPattern, order: order, sorting: sorting, destination: destination)) } /// Returns the sorted elements of a list, a set, or a sorted set. /// - /// - Documentation: [SORT_RO](https:/redis.io/docs/latest/commands/sort_ro) + /// - Documentation: [SORT_RO](https:/valkey.io/commands/sort_ro) /// - Version: 7.0.0 /// - Complexity: O(N+M*log(M)) where N is the number of elements in the list or set to sort, and M the number of returned elements. When the elements are not sorted, complexity is O(N). /// - Categories: @read, @set, @sortedset, @list, @slow, @dangerous - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of sorted elements. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of sorted elements. @inlinable - public func sortRo(key: RedisKey, byPattern: String? = nil, limit: SORTRO.Limit? = nil, getPattern: [String] = [], order: SORTRO.Order? = nil, sorting: Bool = false) async throws -> [RESPToken] { + public func sortRo(key: RESPKey, byPattern: String? = nil, limit: SORTRO.Limit? = nil, getPattern: [String] = [], order: SORTRO.Order? = nil, sorting: Bool = false) async throws -> [RESPToken] { try await send(command: SORTRO(key: key, byPattern: byPattern, limit: limit, getPattern: getPattern, order: order, sorting: sorting)) } /// Returns the number of existing keys out of those specified after updating the time they were last accessed. /// - /// - Documentation: [TOUCH](https:/redis.io/docs/latest/commands/touch) + /// - Documentation: [TOUCH](https:/valkey.io/commands/touch) /// - Version: 3.2.1 /// - Complexity: O(N) where N is the number of keys that will be touched. /// - Categories: @keyspace, @read, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of touched keys. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of touched keys. @inlinable - public func touch(key: [RedisKey]) async throws -> Int { + public func touch(key: [RESPKey]) async throws -> Int { try await send(command: TOUCH(key: key)) } /// Returns the expiration time in seconds of a key. /// - /// - Documentation: [TTL](https:/redis.io/docs/latest/commands/ttl) + /// - Documentation: [TTL](https:/valkey.io/commands/ttl) /// - Version: 1.0.0 /// - Complexity: O(1) /// - Categories: @keyspace, @read, @fast /// - Returns: One of the following: - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): TTL in seconds. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `-1` if the key exists but has no associated expiration. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `-2` if the key does not exist. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): TTL in seconds. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `-1` if the key exists but has no associated expiration. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `-2` if the key does not exist. @inlinable - public func ttl(key: RedisKey) async throws -> Int { + public func ttl(key: RESPKey) async throws -> Int { try await send(command: TTL(key: key)) } /// Determines the type of value stored at a key. /// - /// - Documentation: [TYPE](https:/redis.io/docs/latest/commands/type) + /// - Documentation: [TYPE](https:/valkey.io/commands/type) /// - Version: 1.0.0 /// - Complexity: O(1) /// - Categories: @keyspace, @read, @fast - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): the type of _key_, or `none` when _key_ doesn't exist. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): the type of _key_, or `none` when _key_ doesn't exist. @inlinable - public func type(key: RedisKey) async throws -> String { + public func type(key: RESPKey) async throws -> String { try await send(command: TYPE(key: key)) } /// Asynchronously deletes one or more keys. /// - /// - Documentation: [UNLINK](https:/redis.io/docs/latest/commands/unlink) + /// - Documentation: [UNLINK](https:/valkey.io/commands/unlink) /// - Version: 4.0.0 /// - Complexity: O(1) for each key removed regardless of its size. Then the command does O(N) work in a different thread in order to reclaim memory, where N is the number of allocations the deleted objects where composed of. /// - Categories: @keyspace, @write, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of keys that were unlinked. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of keys that were unlinked. @inlinable - public func unlink(key: [RedisKey]) async throws -> Int { + public func unlink(key: [RESPKey]) async throws -> Int { try await send(command: UNLINK(key: key)) } /// Blocks until the asynchronous replication of all preceding write commands sent by the connection is completed. /// - /// - Documentation: [WAIT](https:/redis.io/docs/latest/commands/wait) + /// - Documentation: [WAIT](https:/valkey.io/commands/wait) /// - Version: 3.0.0 /// - Complexity: O(1) /// - Categories: @slow, @connection - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of replicas reached by all the writes performed in the context of the current connection. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of replicas reached by all the writes performed in the context of the current connection. @inlinable public func wait(numreplicas: Int, timeout: Int) async throws -> Int { try await send(command: WAIT(numreplicas: numreplicas, timeout: timeout)) @@ -1189,12 +1188,12 @@ extension RedisConnection { /// Blocks until all of the preceding write commands sent by the connection are written to the append-only file of the master and/or replicas. /// - /// - Documentation: [WAITAOF](https:/redis.io/docs/latest/commands/waitaof) + /// - Documentation: [WAITAOF](https:/valkey.io/commands/waitaof) /// - Version: 7.2.0 /// - Complexity: O(1) /// - Categories: @slow, @connection - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): The command returns an array of two integers: - /// 1. The first is the number of local Redises (0 or 1) that have fsynced to AOF all writes performed in the context of the current connection + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): The command returns an array of two integers: + /// 1. The first is the number of local Valkey nodes (0 or 1) that have fsynced to AOF all writes performed in the context of the current connection /// 2. The second is the number of replicas that have acknowledged doing the same. @inlinable public func waitaof(numlocal: Int, numreplicas: Int, timeout: Int) async throws -> [RESPToken] { diff --git a/Sources/RedisCommands/GeoCommands.swift b/Sources/Valkey/Commands/GeoCommands.swift similarity index 67% rename from Sources/RedisCommands/GeoCommands.swift rename to Sources/Valkey/Commands/GeoCommands.swift index 9a6b5216..9aa983c1 100644 --- a/Sources/RedisCommands/GeoCommands.swift +++ b/Sources/Valkey/Commands/GeoCommands.swift @@ -1,21 +1,20 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -// This file is autogenerated by RedisCommandsBuilder +// This file is autogenerated by ValkeyCommandsBuilder import NIOCore -import Redis #if canImport(FoundationEssentials) import FoundationEssentials @@ -24,13 +23,13 @@ import Foundation #endif /// Adds one or more members to a geospatial index. The key is created if it doesn't exist. -public struct GEOADD: RedisCommand { +public struct GEOADD: RESPCommand { public enum Condition: RESPRenderable { case nx case xx @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .nx: "NX".encode(into: &commandEncoder) case .xx: "XX".encode(into: &commandEncoder) @@ -43,7 +42,7 @@ public struct GEOADD: RedisCommand { @usableFromInline let member: String @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += longitude.encode(into: &commandEncoder) count += latitude.encode(into: &commandEncoder) @@ -53,25 +52,25 @@ public struct GEOADD: RedisCommand { } public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var condition: Condition? = nil public var change: Bool = false public var data: [Data] - @inlinable public init(key: RedisKey, condition: Condition? = nil, change: Bool = false, data: [Data]) { + @inlinable public init(key: RESPKey, condition: Condition? = nil, change: Bool = false, data: [Data]) { self.key = key self.condition = condition self.change = change self.data = data } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("GEOADD", key, condition, RedisPureToken("CH", change), data) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("GEOADD", key, condition, RESPPureToken("CH", change), data) } } /// Returns the distance between two members of a geospatial index. -public struct GEODIST: RedisCommand { +public struct GEODIST: RESPCommand { public enum Unit: RESPRenderable { case m case km @@ -79,7 +78,7 @@ public struct GEODIST: RedisCommand { case mi @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .m: "M".encode(into: &commandEncoder) case .km: "KM".encode(into: &commandEncoder) @@ -90,59 +89,59 @@ public struct GEODIST: RedisCommand { } public typealias Response = String? - public var key: RedisKey + public var key: RESPKey public var member1: String public var member2: String public var unit: Unit? = nil - @inlinable public init(key: RedisKey, member1: String, member2: String, unit: Unit? = nil) { + @inlinable public init(key: RESPKey, member1: String, member2: String, unit: Unit? = nil) { self.key = key self.member1 = member1 self.member2 = member2 self.unit = unit } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("GEODIST", key, member1, member2, unit) } } /// Returns members from a geospatial index as geohash strings. -public struct GEOHASH: RedisCommand { +public struct GEOHASH: RESPCommand { public typealias Response = [RESPToken] - public var key: RedisKey + public var key: RESPKey public var member: [String] = [] - @inlinable public init(key: RedisKey, member: [String] = []) { + @inlinable public init(key: RESPKey, member: [String] = []) { self.key = key self.member = member } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("GEOHASH", key, member) } } /// Returns the longitude and latitude of members from a geospatial index. -public struct GEOPOS: RedisCommand { +public struct GEOPOS: RESPCommand { public typealias Response = [RESPToken] - public var key: RedisKey + public var key: RESPKey public var member: [String] = [] - @inlinable public init(key: RedisKey, member: [String] = []) { + @inlinable public init(key: RESPKey, member: [String] = []) { self.key = key self.member = member } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("GEOPOS", key, member) } } /// Queries a geospatial index for members within a distance from a coordinate, optionally stores the result. -public struct GEORADIUS: RedisCommand { +public struct GEORADIUS: RESPCommand { public enum Unit: RESPRenderable { case m case km @@ -150,7 +149,7 @@ public struct GEORADIUS: RedisCommand { case mi @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .m: "M".encode(into: &commandEncoder) case .km: "KM".encode(into: &commandEncoder) @@ -164,7 +163,7 @@ public struct GEORADIUS: RedisCommand { @usableFromInline let any: Bool @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += RESPWithToken("COUNT", count).encode(into: &commandEncoder) if self.any { count += "ANY".encode(into: &commandEncoder) } @@ -176,7 +175,7 @@ public struct GEORADIUS: RedisCommand { case desc @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .asc: "ASC".encode(into: &commandEncoder) case .desc: "DESC".encode(into: &commandEncoder) @@ -184,11 +183,11 @@ public struct GEORADIUS: RedisCommand { } } public enum Store: RESPRenderable { - case storekey(RedisKey) - case storedistkey(RedisKey) + case storekey(RESPKey) + case storedistkey(RESPKey) @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .storekey(let storekey): RESPWithToken("STORE", storekey).encode(into: &commandEncoder) case .storedistkey(let storedistkey): RESPWithToken("STOREDIST", storedistkey).encode(into: &commandEncoder) @@ -197,7 +196,7 @@ public struct GEORADIUS: RedisCommand { } public typealias Response = RESPToken - public var key: RedisKey + public var key: RESPKey public var longitude: Double public var latitude: Double public var radius: Double @@ -209,7 +208,7 @@ public struct GEORADIUS: RedisCommand { public var order: Order? = nil public var store: Store? = nil - @inlinable public init(key: RedisKey, longitude: Double, latitude: Double, radius: Double, unit: Unit, withcoord: Bool = false, withdist: Bool = false, withhash: Bool = false, countBlock: CountBlock? = nil, order: Order? = nil, store: Store? = nil) { + @inlinable public init(key: RESPKey, longitude: Double, latitude: Double, radius: Double, unit: Unit, withcoord: Bool = false, withdist: Bool = false, withhash: Bool = false, countBlock: CountBlock? = nil, order: Order? = nil, store: Store? = nil) { self.key = key self.longitude = longitude self.latitude = latitude @@ -223,13 +222,13 @@ public struct GEORADIUS: RedisCommand { self.store = store } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("GEORADIUS", key, longitude, latitude, radius, unit, RedisPureToken("WITHCOORD", withcoord), RedisPureToken("WITHDIST", withdist), RedisPureToken("WITHHASH", withhash), countBlock, order, store) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("GEORADIUS", key, longitude, latitude, radius, unit, RESPPureToken("WITHCOORD", withcoord), RESPPureToken("WITHDIST", withdist), RESPPureToken("WITHHASH", withhash), countBlock, order, store) } } /// Queries a geospatial index for members within a distance from a member, optionally stores the result. -public struct GEORADIUSBYMEMBER: RedisCommand { +public struct GEORADIUSBYMEMBER: RESPCommand { public enum Unit: RESPRenderable { case m case km @@ -237,7 +236,7 @@ public struct GEORADIUSBYMEMBER: RedisCommand { case mi @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .m: "M".encode(into: &commandEncoder) case .km: "KM".encode(into: &commandEncoder) @@ -251,7 +250,7 @@ public struct GEORADIUSBYMEMBER: RedisCommand { @usableFromInline let any: Bool @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += RESPWithToken("COUNT", count).encode(into: &commandEncoder) if self.any { count += "ANY".encode(into: &commandEncoder) } @@ -263,7 +262,7 @@ public struct GEORADIUSBYMEMBER: RedisCommand { case desc @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .asc: "ASC".encode(into: &commandEncoder) case .desc: "DESC".encode(into: &commandEncoder) @@ -271,11 +270,11 @@ public struct GEORADIUSBYMEMBER: RedisCommand { } } public enum Store: RESPRenderable { - case storekey(RedisKey) - case storedistkey(RedisKey) + case storekey(RESPKey) + case storedistkey(RESPKey) @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .storekey(let storekey): RESPWithToken("STORE", storekey).encode(into: &commandEncoder) case .storedistkey(let storedistkey): RESPWithToken("STOREDIST", storedistkey).encode(into: &commandEncoder) @@ -284,7 +283,7 @@ public struct GEORADIUSBYMEMBER: RedisCommand { } public typealias Response = RESPToken - public var key: RedisKey + public var key: RESPKey public var member: String public var radius: Double public var unit: Unit @@ -295,7 +294,7 @@ public struct GEORADIUSBYMEMBER: RedisCommand { public var order: Order? = nil public var store: Store? = nil - @inlinable public init(key: RedisKey, member: String, radius: Double, unit: Unit, withcoord: Bool = false, withdist: Bool = false, withhash: Bool = false, countBlock: CountBlock? = nil, order: Order? = nil, store: Store? = nil) { + @inlinable public init(key: RESPKey, member: String, radius: Double, unit: Unit, withcoord: Bool = false, withdist: Bool = false, withhash: Bool = false, countBlock: CountBlock? = nil, order: Order? = nil, store: Store? = nil) { self.key = key self.member = member self.radius = radius @@ -308,13 +307,13 @@ public struct GEORADIUSBYMEMBER: RedisCommand { self.store = store } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("GEORADIUSBYMEMBER", key, member, radius, unit, RedisPureToken("WITHCOORD", withcoord), RedisPureToken("WITHDIST", withdist), RedisPureToken("WITHHASH", withhash), countBlock, order, store) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("GEORADIUSBYMEMBER", key, member, radius, unit, RESPPureToken("WITHCOORD", withcoord), RESPPureToken("WITHDIST", withdist), RESPPureToken("WITHHASH", withhash), countBlock, order, store) } } /// Returns members from a geospatial index that are within a distance from a member. -public struct GEORADIUSBYMEMBERRO: RedisCommand { +public struct GEORADIUSBYMEMBERRO: RESPCommand { public enum Unit: RESPRenderable { case m case km @@ -322,7 +321,7 @@ public struct GEORADIUSBYMEMBERRO: RedisCommand { case mi @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .m: "M".encode(into: &commandEncoder) case .km: "KM".encode(into: &commandEncoder) @@ -336,7 +335,7 @@ public struct GEORADIUSBYMEMBERRO: RedisCommand { @usableFromInline let any: Bool @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += RESPWithToken("COUNT", count).encode(into: &commandEncoder) if self.any { count += "ANY".encode(into: &commandEncoder) } @@ -348,7 +347,7 @@ public struct GEORADIUSBYMEMBERRO: RedisCommand { case desc @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .asc: "ASC".encode(into: &commandEncoder) case .desc: "DESC".encode(into: &commandEncoder) @@ -357,7 +356,7 @@ public struct GEORADIUSBYMEMBERRO: RedisCommand { } public typealias Response = RESPToken - public var key: RedisKey + public var key: RESPKey public var member: String public var radius: Double public var unit: Unit @@ -367,7 +366,7 @@ public struct GEORADIUSBYMEMBERRO: RedisCommand { public var countBlock: CountBlock? = nil public var order: Order? = nil - @inlinable public init(key: RedisKey, member: String, radius: Double, unit: Unit, withcoord: Bool = false, withdist: Bool = false, withhash: Bool = false, countBlock: CountBlock? = nil, order: Order? = nil) { + @inlinable public init(key: RESPKey, member: String, radius: Double, unit: Unit, withcoord: Bool = false, withdist: Bool = false, withhash: Bool = false, countBlock: CountBlock? = nil, order: Order? = nil) { self.key = key self.member = member self.radius = radius @@ -379,13 +378,13 @@ public struct GEORADIUSBYMEMBERRO: RedisCommand { self.order = order } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("GEORADIUSBYMEMBER_RO", key, member, radius, unit, RedisPureToken("WITHCOORD", withcoord), RedisPureToken("WITHDIST", withdist), RedisPureToken("WITHHASH", withhash), countBlock, order) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("GEORADIUSBYMEMBER_RO", key, member, radius, unit, RESPPureToken("WITHCOORD", withcoord), RESPPureToken("WITHDIST", withdist), RESPPureToken("WITHHASH", withhash), countBlock, order) } } /// Returns members from a geospatial index that are within a distance from a coordinate. -public struct GEORADIUSRO: RedisCommand { +public struct GEORADIUSRO: RESPCommand { public enum Unit: RESPRenderable { case m case km @@ -393,7 +392,7 @@ public struct GEORADIUSRO: RedisCommand { case mi @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .m: "M".encode(into: &commandEncoder) case .km: "KM".encode(into: &commandEncoder) @@ -407,7 +406,7 @@ public struct GEORADIUSRO: RedisCommand { @usableFromInline let any: Bool @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += RESPWithToken("COUNT", count).encode(into: &commandEncoder) if self.any { count += "ANY".encode(into: &commandEncoder) } @@ -419,7 +418,7 @@ public struct GEORADIUSRO: RedisCommand { case desc @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .asc: "ASC".encode(into: &commandEncoder) case .desc: "DESC".encode(into: &commandEncoder) @@ -428,7 +427,7 @@ public struct GEORADIUSRO: RedisCommand { } public typealias Response = RESPToken - public var key: RedisKey + public var key: RESPKey public var longitude: Double public var latitude: Double public var radius: Double @@ -439,7 +438,7 @@ public struct GEORADIUSRO: RedisCommand { public var countBlock: CountBlock? = nil public var order: Order? = nil - @inlinable public init(key: RedisKey, longitude: Double, latitude: Double, radius: Double, unit: Unit, withcoord: Bool = false, withdist: Bool = false, withhash: Bool = false, countBlock: CountBlock? = nil, order: Order? = nil) { + @inlinable public init(key: RESPKey, longitude: Double, latitude: Double, radius: Double, unit: Unit, withcoord: Bool = false, withdist: Bool = false, withhash: Bool = false, countBlock: CountBlock? = nil, order: Order? = nil) { self.key = key self.longitude = longitude self.latitude = latitude @@ -452,19 +451,19 @@ public struct GEORADIUSRO: RedisCommand { self.order = order } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("GEORADIUS_RO", key, longitude, latitude, radius, unit, RedisPureToken("WITHCOORD", withcoord), RedisPureToken("WITHDIST", withdist), RedisPureToken("WITHHASH", withhash), countBlock, order) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("GEORADIUS_RO", key, longitude, latitude, radius, unit, RESPPureToken("WITHCOORD", withcoord), RESPPureToken("WITHDIST", withdist), RESPPureToken("WITHHASH", withhash), countBlock, order) } } /// Queries a geospatial index for members inside an area of a box or a circle. -public struct GEOSEARCH: RedisCommand { +public struct GEOSEARCH: RESPCommand { public struct FromFromlonlat: RESPRenderable { @usableFromInline let longitude: Double @usableFromInline let latitude: Double @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += longitude.encode(into: &commandEncoder) count += latitude.encode(into: &commandEncoder) @@ -476,7 +475,7 @@ public struct GEOSEARCH: RedisCommand { case fromlonlat(FromFromlonlat) @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .member(let member): RESPWithToken("FROMMEMBER", member).encode(into: &commandEncoder) case .fromlonlat(let fromlonlat): RESPWithToken("FROMLONLAT", fromlonlat).encode(into: &commandEncoder) @@ -490,7 +489,7 @@ public struct GEOSEARCH: RedisCommand { case mi @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .m: "M".encode(into: &commandEncoder) case .km: "KM".encode(into: &commandEncoder) @@ -504,7 +503,7 @@ public struct GEOSEARCH: RedisCommand { @usableFromInline let unit: ByCircleUnit @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += RESPWithToken("BYRADIUS", radius).encode(into: &commandEncoder) count += unit.encode(into: &commandEncoder) @@ -518,7 +517,7 @@ public struct GEOSEARCH: RedisCommand { case mi @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .m: "M".encode(into: &commandEncoder) case .km: "KM".encode(into: &commandEncoder) @@ -533,7 +532,7 @@ public struct GEOSEARCH: RedisCommand { @usableFromInline let unit: ByBoxUnit @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += RESPWithToken("BYBOX", width).encode(into: &commandEncoder) count += height.encode(into: &commandEncoder) @@ -546,7 +545,7 @@ public struct GEOSEARCH: RedisCommand { case box(ByBox) @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .circle(let circle): circle.encode(into: &commandEncoder) case .box(let box): box.encode(into: &commandEncoder) @@ -558,7 +557,7 @@ public struct GEOSEARCH: RedisCommand { case desc @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .asc: "ASC".encode(into: &commandEncoder) case .desc: "DESC".encode(into: &commandEncoder) @@ -570,7 +569,7 @@ public struct GEOSEARCH: RedisCommand { @usableFromInline let any: Bool @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += RESPWithToken("COUNT", count).encode(into: &commandEncoder) if self.any { count += "ANY".encode(into: &commandEncoder) } @@ -579,7 +578,7 @@ public struct GEOSEARCH: RedisCommand { } public typealias Response = RESPToken - public var key: RedisKey + public var key: RESPKey public var from: From public var by: By public var order: Order? = nil @@ -588,7 +587,7 @@ public struct GEOSEARCH: RedisCommand { public var withdist: Bool = false public var withhash: Bool = false - @inlinable public init(key: RedisKey, from: From, by: By, order: Order? = nil, countBlock: CountBlock? = nil, withcoord: Bool = false, withdist: Bool = false, withhash: Bool = false) { + @inlinable public init(key: RESPKey, from: From, by: By, order: Order? = nil, countBlock: CountBlock? = nil, withcoord: Bool = false, withdist: Bool = false, withhash: Bool = false) { self.key = key self.from = from self.by = by @@ -599,19 +598,19 @@ public struct GEOSEARCH: RedisCommand { self.withhash = withhash } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("GEOSEARCH", key, from, by, order, countBlock, RedisPureToken("WITHCOORD", withcoord), RedisPureToken("WITHDIST", withdist), RedisPureToken("WITHHASH", withhash)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("GEOSEARCH", key, from, by, order, countBlock, RESPPureToken("WITHCOORD", withcoord), RESPPureToken("WITHDIST", withdist), RESPPureToken("WITHHASH", withhash)) } } /// Queries a geospatial index for members inside an area of a box or a circle, optionally stores the result. -public struct GEOSEARCHSTORE: RedisCommand { +public struct GEOSEARCHSTORE: RESPCommand { public struct FromFromlonlat: RESPRenderable { @usableFromInline let longitude: Double @usableFromInline let latitude: Double @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += longitude.encode(into: &commandEncoder) count += latitude.encode(into: &commandEncoder) @@ -623,7 +622,7 @@ public struct GEOSEARCHSTORE: RedisCommand { case fromlonlat(FromFromlonlat) @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .member(let member): RESPWithToken("FROMMEMBER", member).encode(into: &commandEncoder) case .fromlonlat(let fromlonlat): RESPWithToken("FROMLONLAT", fromlonlat).encode(into: &commandEncoder) @@ -637,7 +636,7 @@ public struct GEOSEARCHSTORE: RedisCommand { case mi @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .m: "M".encode(into: &commandEncoder) case .km: "KM".encode(into: &commandEncoder) @@ -651,7 +650,7 @@ public struct GEOSEARCHSTORE: RedisCommand { @usableFromInline let unit: ByCircleUnit @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += RESPWithToken("BYRADIUS", radius).encode(into: &commandEncoder) count += unit.encode(into: &commandEncoder) @@ -665,7 +664,7 @@ public struct GEOSEARCHSTORE: RedisCommand { case mi @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .m: "M".encode(into: &commandEncoder) case .km: "KM".encode(into: &commandEncoder) @@ -680,7 +679,7 @@ public struct GEOSEARCHSTORE: RedisCommand { @usableFromInline let unit: ByBoxUnit @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += RESPWithToken("BYBOX", width).encode(into: &commandEncoder) count += height.encode(into: &commandEncoder) @@ -693,7 +692,7 @@ public struct GEOSEARCHSTORE: RedisCommand { case box(ByBox) @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .circle(let circle): circle.encode(into: &commandEncoder) case .box(let box): box.encode(into: &commandEncoder) @@ -705,7 +704,7 @@ public struct GEOSEARCHSTORE: RedisCommand { case desc @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .asc: "ASC".encode(into: &commandEncoder) case .desc: "DESC".encode(into: &commandEncoder) @@ -717,7 +716,7 @@ public struct GEOSEARCHSTORE: RedisCommand { @usableFromInline let any: Bool @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += RESPWithToken("COUNT", count).encode(into: &commandEncoder) if self.any { count += "ANY".encode(into: &commandEncoder) } @@ -726,15 +725,15 @@ public struct GEOSEARCHSTORE: RedisCommand { } public typealias Response = Int - public var destination: RedisKey - public var source: RedisKey + public var destination: RESPKey + public var source: RESPKey public var from: From public var by: By public var order: Order? = nil public var countBlock: CountBlock? = nil public var storedist: Bool = false - @inlinable public init(destination: RedisKey, source: RedisKey, from: From, by: By, order: Order? = nil, countBlock: CountBlock? = nil, storedist: Bool = false) { + @inlinable public init(destination: RESPKey, source: RESPKey, from: From, by: By, order: Order? = nil, countBlock: CountBlock? = nil, storedist: Bool = false) { self.destination = destination self.source = source self.from = from @@ -744,72 +743,72 @@ public struct GEOSEARCHSTORE: RedisCommand { self.storedist = storedist } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("GEOSEARCHSTORE", destination, source, from, by, order, countBlock, RedisPureToken("STOREDIST", storedist)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("GEOSEARCHSTORE", destination, source, from, by, order, countBlock, RESPPureToken("STOREDIST", storedist)) } } -extension RedisConnection { +extension ValkeyConnection { /// Adds one or more members to a geospatial index. The key is created if it doesn't exist. /// - /// - Documentation: [GEOADD](https:/redis.io/docs/latest/commands/geoadd) + /// - Documentation: [GEOADD](https:/valkey.io/commands/geoadd) /// - Version: 3.2.0 /// - Complexity: O(log(N)) for each item added, where N is the number of elements in the sorted set. /// - Categories: @write, @geo, @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): When used without optional arguments, the number of elements added to the sorted set (excluding score updates). If the CH option is specified, the number of elements that were changed (added or updated). + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): When used without optional arguments, the number of elements added to the sorted set (excluding score updates). If the CH option is specified, the number of elements that were changed (added or updated). @inlinable - public func geoadd(key: RedisKey, condition: GEOADD.Condition? = nil, change: Bool = false, data: [GEOADD.Data]) async throws -> Int { + public func geoadd(key: RESPKey, condition: GEOADD.Condition? = nil, change: Bool = false, data: [GEOADD.Data]) async throws -> Int { try await send(command: GEOADD(key: key, condition: condition, change: change, data: data)) } /// Returns the distance between two members of a geospatial index. /// - /// - Documentation: [GEODIST](https:/redis.io/docs/latest/commands/geodist) + /// - Documentation: [GEODIST](https:/valkey.io/commands/geodist) /// - Version: 3.2.0 /// - Complexity: O(1) /// - Categories: @read, @geo, @slow /// - Returns: One of the following: - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): one or both of the elements are missing. - /// * [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): distance as a double (represented as a string) in the specified units. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): one or both of the elements are missing. + /// * [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): distance as a double (represented as a string) in the specified units. @inlinable - public func geodist(key: RedisKey, member1: String, member2: String, unit: GEODIST.Unit? = nil) async throws -> String? { + public func geodist(key: RESPKey, member1: String, member2: String, unit: GEODIST.Unit? = nil) async throws -> String? { try await send(command: GEODIST(key: key, member1: member1, member2: member2, unit: unit)) } /// Returns members from a geospatial index as geohash strings. /// - /// - Documentation: [GEOHASH](https:/redis.io/docs/latest/commands/geohash) + /// - Documentation: [GEOHASH](https:/valkey.io/commands/geohash) /// - Version: 3.2.0 /// - Complexity: O(1) for each member requested. /// - Categories: @read, @geo, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): An array where each element is the Geohash corresponding to each member name passed as an argument to the command. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): an array where each element is the Geohash corresponding to each member name passed as an argument to the command. @inlinable - public func geohash(key: RedisKey, member: [String] = []) async throws -> [RESPToken] { + public func geohash(key: RESPKey, member: [String] = []) async throws -> [RESPToken] { try await send(command: GEOHASH(key: key, member: member)) } /// Returns the longitude and latitude of members from a geospatial index. /// - /// - Documentation: [GEOPOS](https:/redis.io/docs/latest/commands/geopos) + /// - Documentation: [GEOPOS](https:/valkey.io/commands/geopos) /// - Version: 3.2.0 /// - Complexity: O(1) for each member requested. /// - Categories: @read, @geo, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): An array where each element is a two elements array representing longitude and latitude (x,y) of each member name passed as argument to the command. Non-existing elements are reported as [Null](https:/redis.io/docs/reference/protocol-spec#nulls) elements of the array. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): an array where each element is a two elements array representing longitude and latitude (x,y) of each member name passed as argument to the command. Non-existing elements are reported as [Null](https:/valkey.io/topics/protocol/#nulls) elements of the array. @inlinable - public func geopos(key: RedisKey, member: [String] = []) async throws -> [RESPToken] { + public func geopos(key: RESPKey, member: [String] = []) async throws -> [RESPToken] { try await send(command: GEOPOS(key: key, member: member)) } /// Queries a geospatial index for members within a distance from a coordinate, optionally stores the result. /// - /// - Documentation: [GEORADIUS](https:/redis.io/docs/latest/commands/georadius) + /// - Documentation: [GEORADIUS](https:/valkey.io/commands/georadius) /// - Version: 3.2.0 /// - Complexity: O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index. /// - Categories: @write, @geo, @slow /// - Returns: One of the following: - /// * If no `WITH*` option is specified, an [Array](https:/redis.io/docs/reference/protocol-spec#arrays) of matched member names - /// * If `WITHCOORD`, `WITHDIST`, or `WITHHASH` options are specified, the command returns an [Array](https:/redis.io/docs/reference/protocol-spec#arrays) of arrays, where each sub-array represents a single item: + /// * If no `WITH*` option is specified, an [Array](https:/valkey.io/topics/protocol/#arrays) of matched member names + /// * If `WITHCOORD`, `WITHDIST`, or `WITHHASH` options are specified, the command returns an [Array](https:/valkey.io/topics/protocol/#arrays) of arrays, where each sub-array represents a single item: /// 1. The distance from the center as a floating point number, in the same unit specified in the radius. /// 1. The Geohash integer. /// 1. The coordinates as a two items x,y array (longitude,latitude). @@ -818,87 +817,87 @@ extension RedisConnection { /// /// `["Palermo","190.4424",["13.361389338970184","38.115556395496299"]]` @inlinable - public func georadius(key: RedisKey, longitude: Double, latitude: Double, radius: Double, unit: GEORADIUS.Unit, withcoord: Bool = false, withdist: Bool = false, withhash: Bool = false, countBlock: GEORADIUS.CountBlock? = nil, order: GEORADIUS.Order? = nil, store: GEORADIUS.Store? = nil) async throws -> RESPToken { + public func georadius(key: RESPKey, longitude: Double, latitude: Double, radius: Double, unit: GEORADIUS.Unit, withcoord: Bool = false, withdist: Bool = false, withhash: Bool = false, countBlock: GEORADIUS.CountBlock? = nil, order: GEORADIUS.Order? = nil, store: GEORADIUS.Store? = nil) async throws -> RESPToken { try await send(command: GEORADIUS(key: key, longitude: longitude, latitude: latitude, radius: radius, unit: unit, withcoord: withcoord, withdist: withdist, withhash: withhash, countBlock: countBlock, order: order, store: store)) } /// Queries a geospatial index for members within a distance from a member, optionally stores the result. /// - /// - Documentation: [GEORADIUSBYMEMBER](https:/redis.io/docs/latest/commands/georadiusbymember) + /// - Documentation: [GEORADIUSBYMEMBER](https:/valkey.io/commands/georadiusbymember) /// - Version: 3.2.0 /// - Complexity: O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index. /// - Categories: @write, @geo, @slow /// - Returns: One of the following: - /// * If no `WITH*` option is specified, an [Array](https:/redis.io/docs/reference/protocol-spec#arrays) of matched member names - /// * If `WITHCOORD`, `WITHDIST`, or `WITHHASH` options are specified, the command returns an [Array](https:/redis.io/docs/reference/protocol-spec#arrays) of arrays, where each sub-array represents a single item: + /// * If no `WITH*` option is specified, an [Array](https:/valkey.io/topics/protocol/#arrays) of matched member names + /// * If `WITHCOORD`, `WITHDIST`, or `WITHHASH` options are specified, the command returns an [Array](https:/valkey.io/topics/protocol/#arrays) of arrays, where each sub-array represents a single item: /// * The distance from the center as a floating point number, in the same unit specified in the radius. /// * The Geohash integer. /// * The coordinates as a two items x,y array (longitude,latitude). @inlinable - public func georadiusbymember(key: RedisKey, member: String, radius: Double, unit: GEORADIUSBYMEMBER.Unit, withcoord: Bool = false, withdist: Bool = false, withhash: Bool = false, countBlock: GEORADIUSBYMEMBER.CountBlock? = nil, order: GEORADIUSBYMEMBER.Order? = nil, store: GEORADIUSBYMEMBER.Store? = nil) async throws -> RESPToken { + public func georadiusbymember(key: RESPKey, member: String, radius: Double, unit: GEORADIUSBYMEMBER.Unit, withcoord: Bool = false, withdist: Bool = false, withhash: Bool = false, countBlock: GEORADIUSBYMEMBER.CountBlock? = nil, order: GEORADIUSBYMEMBER.Order? = nil, store: GEORADIUSBYMEMBER.Store? = nil) async throws -> RESPToken { try await send(command: GEORADIUSBYMEMBER(key: key, member: member, radius: radius, unit: unit, withcoord: withcoord, withdist: withdist, withhash: withhash, countBlock: countBlock, order: order, store: store)) } /// Returns members from a geospatial index that are within a distance from a member. /// - /// - Documentation: [GEORADIUSBYMEMBER_RO](https:/redis.io/docs/latest/commands/georadiusbymember_ro) + /// - Documentation: [GEORADIUSBYMEMBER_RO](https:/valkey.io/commands/georadiusbymember_ro) /// - Version: 3.2.10 /// - Complexity: O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index. /// - Categories: @read, @geo, @slow /// - Returns: One of the following: - /// * If no `WITH*` option is specified, an [Array](https:/redis.io/docs/reference/protocol-spec#arrays) of matched member names - /// * If `WITHCOORD`, `WITHDIST`, or `WITHHASH` options are specified, the command returns an [Array](https:/redis.io/docs/reference/protocol-spec#arrays) of arrays, where each sub-array represents a single item: + /// * If no `WITH*` option is specified, an [Array](https:/valkey.io/topics/protocol/#arrays) of matched member names + /// * If `WITHCOORD`, `WITHDIST`, or `WITHHASH` options are specified, the command returns an [Array](https:/valkey.io/topics/protocol/#arrays) of arrays, where each sub-array represents a single item: /// * The distance from the center as a floating point number, in the same unit specified in the radius. /// * The Geohash integer. /// * The coordinates as a two items x,y array (longitude,latitude). @inlinable - public func georadiusbymemberRo(key: RedisKey, member: String, radius: Double, unit: GEORADIUSBYMEMBERRO.Unit, withcoord: Bool = false, withdist: Bool = false, withhash: Bool = false, countBlock: GEORADIUSBYMEMBERRO.CountBlock? = nil, order: GEORADIUSBYMEMBERRO.Order? = nil) async throws -> RESPToken { + public func georadiusbymemberRo(key: RESPKey, member: String, radius: Double, unit: GEORADIUSBYMEMBERRO.Unit, withcoord: Bool = false, withdist: Bool = false, withhash: Bool = false, countBlock: GEORADIUSBYMEMBERRO.CountBlock? = nil, order: GEORADIUSBYMEMBERRO.Order? = nil) async throws -> RESPToken { try await send(command: GEORADIUSBYMEMBERRO(key: key, member: member, radius: radius, unit: unit, withcoord: withcoord, withdist: withdist, withhash: withhash, countBlock: countBlock, order: order)) } /// Returns members from a geospatial index that are within a distance from a coordinate. /// - /// - Documentation: [GEORADIUS_RO](https:/redis.io/docs/latest/commands/georadius_ro) + /// - Documentation: [GEORADIUS_RO](https:/valkey.io/commands/georadius_ro) /// - Version: 3.2.10 /// - Complexity: O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index. /// - Categories: @read, @geo, @slow /// - Returns: One of the following: - /// * If no `WITH*` option is specified, an [Array](https:/redis.io/docs/reference/protocol-spec#arrays) of matched member names - /// * If `WITHCOORD`, `WITHDIST`, or `WITHHASH` options are specified, the command returns an [Array](https:/redis.io/docs/reference/protocol-spec#arrays) of arrays, where each sub-array represents a single item: + /// * If no `WITH*` option is specified, an [Array](https:/valkey.io/topics/protocol/#arrays) of matched member names + /// * If `WITHCOORD`, `WITHDIST`, or `WITHHASH` options are specified, the command returns an [Array](https:/valkey.io/topics/protocol/#arrays) of arrays, where each sub-array represents a single item: /// * The distance from the center as a floating point number, in the same unit specified in the radius. /// * The Geohash integer. /// * The coordinates as a two items x,y array (longitude,latitude). @inlinable - public func georadiusRo(key: RedisKey, longitude: Double, latitude: Double, radius: Double, unit: GEORADIUSRO.Unit, withcoord: Bool = false, withdist: Bool = false, withhash: Bool = false, countBlock: GEORADIUSRO.CountBlock? = nil, order: GEORADIUSRO.Order? = nil) async throws -> RESPToken { + public func georadiusRo(key: RESPKey, longitude: Double, latitude: Double, radius: Double, unit: GEORADIUSRO.Unit, withcoord: Bool = false, withdist: Bool = false, withhash: Bool = false, countBlock: GEORADIUSRO.CountBlock? = nil, order: GEORADIUSRO.Order? = nil) async throws -> RESPToken { try await send(command: GEORADIUSRO(key: key, longitude: longitude, latitude: latitude, radius: radius, unit: unit, withcoord: withcoord, withdist: withdist, withhash: withhash, countBlock: countBlock, order: order)) } /// Queries a geospatial index for members inside an area of a box or a circle. /// - /// - Documentation: [GEOSEARCH](https:/redis.io/docs/latest/commands/geosearch) + /// - Documentation: [GEOSEARCH](https:/valkey.io/commands/geosearch) /// - Version: 6.2.0 /// - Complexity: O(N+log(M)) where N is the number of elements in the grid-aligned bounding box area around the shape provided as the filter and M is the number of items inside the shape /// - Categories: @read, @geo, @slow /// - Returns: One of the following: - /// * If no `WITH*` option is specified, an [Array](https:/redis.io/docs/reference/protocol-spec#arrays) of matched member names - /// * If `WITHCOORD`, `WITHDIST`, or `WITHHASH` options are specified, the command returns an [Array](https:/redis.io/docs/reference/protocol-spec#arrays) of arrays, where each sub-array represents a single item: + /// * If no `WITH*` option is specified, an [Array](https:/valkey.io/topics/protocol/#arrays) of matched member names + /// * If `WITHCOORD`, `WITHDIST`, or `WITHHASH` options are specified, the command returns an [Array](https:/valkey.io/topics/protocol/#arrays) of arrays, where each sub-array represents a single item: /// * The distance from the center as a floating point number, in the same unit specified in the radius. /// * The Geohash integer. /// * The coordinates as a two items x,y array (longitude,latitude). @inlinable - public func geosearch(key: RedisKey, from: GEOSEARCH.From, by: GEOSEARCH.By, order: GEOSEARCH.Order? = nil, countBlock: GEOSEARCH.CountBlock? = nil, withcoord: Bool = false, withdist: Bool = false, withhash: Bool = false) async throws -> RESPToken { + public func geosearch(key: RESPKey, from: GEOSEARCH.From, by: GEOSEARCH.By, order: GEOSEARCH.Order? = nil, countBlock: GEOSEARCH.CountBlock? = nil, withcoord: Bool = false, withdist: Bool = false, withhash: Bool = false) async throws -> RESPToken { try await send(command: GEOSEARCH(key: key, from: from, by: by, order: order, countBlock: countBlock, withcoord: withcoord, withdist: withdist, withhash: withhash)) } /// Queries a geospatial index for members inside an area of a box or a circle, optionally stores the result. /// - /// - Documentation: [GEOSEARCHSTORE](https:/redis.io/docs/latest/commands/geosearchstore) + /// - Documentation: [GEOSEARCHSTORE](https:/valkey.io/commands/geosearchstore) /// - Version: 6.2.0 /// - Complexity: O(N+log(M)) where N is the number of elements in the grid-aligned bounding box area around the shape provided as the filter and M is the number of items inside the shape /// - Categories: @write, @geo, @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of elements in the resulting set + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of elements in the resulting set @inlinable - public func geosearchstore(destination: RedisKey, source: RedisKey, from: GEOSEARCHSTORE.From, by: GEOSEARCHSTORE.By, order: GEOSEARCHSTORE.Order? = nil, countBlock: GEOSEARCHSTORE.CountBlock? = nil, storedist: Bool = false) async throws -> Int { + public func geosearchstore(destination: RESPKey, source: RESPKey, from: GEOSEARCHSTORE.From, by: GEOSEARCHSTORE.By, order: GEOSEARCHSTORE.Order? = nil, countBlock: GEOSEARCHSTORE.CountBlock? = nil, storedist: Bool = false) async throws -> Int { try await send(command: GEOSEARCHSTORE(destination: destination, source: source, from: from, by: by, order: order, countBlock: countBlock, storedist: storedist)) } diff --git a/Sources/RedisCommands/HashCommands.swift b/Sources/Valkey/Commands/HashCommands.swift similarity index 50% rename from Sources/RedisCommands/HashCommands.swift rename to Sources/Valkey/Commands/HashCommands.swift index 96497651..5cd2f552 100644 --- a/Sources/RedisCommands/HashCommands.swift +++ b/Sources/Valkey/Commands/HashCommands.swift @@ -1,21 +1,20 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -// This file is autogenerated by RedisCommandsBuilder +// This file is autogenerated by ValkeyCommandsBuilder import NIOCore -import Redis #if canImport(FoundationEssentials) import FoundationEssentials @@ -24,164 +23,164 @@ import Foundation #endif /// Deletes one or more fields and their values from a hash. Deletes the hash if no fields remain. -public struct HDEL: RedisCommand { +public struct HDEL: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var field: [String] - @inlinable public init(key: RedisKey, field: [String]) { + @inlinable public init(key: RESPKey, field: [String]) { self.key = key self.field = field } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("HDEL", key, field) } } /// Determines whether a field exists in a hash. -public struct HEXISTS: RedisCommand { +public struct HEXISTS: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var field: String - @inlinable public init(key: RedisKey, field: String) { + @inlinable public init(key: RESPKey, field: String) { self.key = key self.field = field } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("HEXISTS", key, field) } } /// Returns the value of a field in a hash. -public struct HGET: RedisCommand { +public struct HGET: RESPCommand { public typealias Response = String? - public var key: RedisKey + public var key: RESPKey public var field: String - @inlinable public init(key: RedisKey, field: String) { + @inlinable public init(key: RESPKey, field: String) { self.key = key self.field = field } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("HGET", key, field) } } /// Returns all fields and values in a hash. -public struct HGETALL: RedisCommand { +public struct HGETALL: RESPCommand { public typealias Response = [String: RESPToken] - public var key: RedisKey + public var key: RESPKey - @inlinable public init(key: RedisKey) { + @inlinable public init(key: RESPKey) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("HGETALL", key) } } /// Increments the integer value of a field in a hash by a number. Uses 0 as initial value if the field doesn't exist. -public struct HINCRBY: RedisCommand { +public struct HINCRBY: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var field: String public var increment: Int - @inlinable public init(key: RedisKey, field: String, increment: Int) { + @inlinable public init(key: RESPKey, field: String, increment: Int) { self.key = key self.field = field self.increment = increment } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("HINCRBY", key, field, increment) } } /// Increments the floating point value of a field by a number. Uses 0 as initial value if the field doesn't exist. -public struct HINCRBYFLOAT: RedisCommand { +public struct HINCRBYFLOAT: RESPCommand { public typealias Response = String - public var key: RedisKey + public var key: RESPKey public var field: String public var increment: Double - @inlinable public init(key: RedisKey, field: String, increment: Double) { + @inlinable public init(key: RESPKey, field: String, increment: Double) { self.key = key self.field = field self.increment = increment } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("HINCRBYFLOAT", key, field, increment) } } /// Returns all fields in a hash. -public struct HKEYS: RedisCommand { +public struct HKEYS: RESPCommand { public typealias Response = [RESPToken] - public var key: RedisKey + public var key: RESPKey - @inlinable public init(key: RedisKey) { + @inlinable public init(key: RESPKey) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("HKEYS", key) } } /// Returns the number of fields in a hash. -public struct HLEN: RedisCommand { +public struct HLEN: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey - @inlinable public init(key: RedisKey) { + @inlinable public init(key: RESPKey) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("HLEN", key) } } /// Returns the values of all fields in a hash. -public struct HMGET: RedisCommand { +public struct HMGET: RESPCommand { public typealias Response = [RESPToken] - public var key: RedisKey + public var key: RESPKey public var field: [String] - @inlinable public init(key: RedisKey, field: [String]) { + @inlinable public init(key: RESPKey, field: [String]) { self.key = key self.field = field } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("HMGET", key, field) } } /// Sets the values of multiple fields. -public struct HMSET: RedisCommand { +public struct HMSET: RESPCommand { public struct Data: RESPRenderable { @usableFromInline let field: String @usableFromInline let value: String @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += field.encode(into: &commandEncoder) count += value.encode(into: &commandEncoder) @@ -190,27 +189,27 @@ public struct HMSET: RedisCommand { } public typealias Response = RESPToken - public var key: RedisKey + public var key: RESPKey public var data: [Data] - @inlinable public init(key: RedisKey, data: [Data]) { + @inlinable public init(key: RESPKey, data: [Data]) { self.key = key self.data = data } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("HMSET", key, data) } } /// Returns one or more random fields from a hash. -public struct HRANDFIELD: RedisCommand { +public struct HRANDFIELD: RESPCommand { public struct Options: RESPRenderable { @usableFromInline let count: Int @usableFromInline let withvalues: Bool @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += count.encode(into: &commandEncoder) if self.withvalues { count += "WITHVALUES".encode(into: &commandEncoder) } @@ -219,48 +218,48 @@ public struct HRANDFIELD: RedisCommand { } public typealias Response = RESPToken - public var key: RedisKey + public var key: RESPKey public var options: Options? = nil - @inlinable public init(key: RedisKey, options: Options? = nil) { + @inlinable public init(key: RESPKey, options: Options? = nil) { self.key = key self.options = options } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("HRANDFIELD", key, options) } } /// Iterates over fields and values of a hash. -public struct HSCAN: RedisCommand { +public struct HSCAN: RESPCommand { public typealias Response = [RESPToken] - public var key: RedisKey + public var key: RESPKey public var cursor: Int public var pattern: String? = nil public var count: Int? = nil - @inlinable public init(key: RedisKey, cursor: Int, pattern: String? = nil, count: Int? = nil) { + @inlinable public init(key: RESPKey, cursor: Int, pattern: String? = nil, count: Int? = nil) { self.key = key self.cursor = cursor self.pattern = pattern self.count = count } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("HSCAN", key, cursor, RESPWithToken("MATCH", pattern), RESPWithToken("COUNT", count)) } } /// Creates or modifies the value of a field in a hash. -public struct HSET: RedisCommand { +public struct HSET: RESPCommand { public struct Data: RESPRenderable { @usableFromInline let field: String @usableFromInline let value: String @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += field.encode(into: &commandEncoder) count += value.encode(into: &commandEncoder) @@ -269,273 +268,273 @@ public struct HSET: RedisCommand { } public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var data: [Data] - @inlinable public init(key: RedisKey, data: [Data]) { + @inlinable public init(key: RESPKey, data: [Data]) { self.key = key self.data = data } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("HSET", key, data) } } /// Sets the value of a field in a hash only when the field doesn't exist. -public struct HSETNX: RedisCommand { +public struct HSETNX: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var field: String public var value: String - @inlinable public init(key: RedisKey, field: String, value: String) { + @inlinable public init(key: RESPKey, field: String, value: String) { self.key = key self.field = field self.value = value } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("HSETNX", key, field, value) } } /// Returns the length of the value of a field. -public struct HSTRLEN: RedisCommand { +public struct HSTRLEN: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var field: String - @inlinable public init(key: RedisKey, field: String) { + @inlinable public init(key: RESPKey, field: String) { self.key = key self.field = field } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("HSTRLEN", key, field) } } /// Returns all values in a hash. -public struct HVALS: RedisCommand { +public struct HVALS: RESPCommand { public typealias Response = [RESPToken] - public var key: RedisKey + public var key: RESPKey - @inlinable public init(key: RedisKey) { + @inlinable public init(key: RESPKey) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("HVALS", key) } } -extension RedisConnection { +extension ValkeyConnection { /// Deletes one or more fields and their values from a hash. Deletes the hash if no fields remain. /// - /// - Documentation: [HDEL](https:/redis.io/docs/latest/commands/hdel) + /// - Documentation: [HDEL](https:/valkey.io/commands/hdel) /// - Version: 2.0.0 /// - Complexity: O(N) where N is the number of fields to be removed. /// - Categories: @write, @hash, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): The number of fields that were removed from the hash, excluding any specified but non-existing fields. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of fields that were removed from the hash, excluding any specified but non-existing fields. @inlinable - public func hdel(key: RedisKey, field: [String]) async throws -> Int { + public func hdel(key: RESPKey, field: [String]) async throws -> Int { try await send(command: HDEL(key: key, field: field)) } /// Determines whether a field exists in a hash. /// - /// - Documentation: [HEXISTS](https:/redis.io/docs/latest/commands/hexists) + /// - Documentation: [HEXISTS](https:/valkey.io/commands/hexists) /// - Version: 2.0.0 /// - Complexity: O(1) /// - Categories: @read, @hash, @fast /// - Returns: One of the following: - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `0` if the hash does not contain the field, or the key does not exist. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `1` if the hash contains the field. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `0` if the hash does not contain the field, or the key does not exist. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `1` if the hash contains the field. @inlinable - public func hexists(key: RedisKey, field: String) async throws -> Int { + public func hexists(key: RESPKey, field: String) async throws -> Int { try await send(command: HEXISTS(key: key, field: field)) } /// Returns the value of a field in a hash. /// - /// - Documentation: [HGET](https:/redis.io/docs/latest/commands/hget) + /// - Documentation: [HGET](https:/valkey.io/commands/hget) /// - Version: 2.0.0 /// - Complexity: O(1) /// - Categories: @read, @hash, @fast /// - Returns: One of the following: - /// * [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): The value associated with the field. - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): If the field is not present in the hash or key does not exist. + /// * [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): The value associated with the field. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): If the field is not present in the hash or key does not exist. @inlinable - public func hget(key: RedisKey, field: String) async throws -> String? { + public func hget(key: RESPKey, field: String) async throws -> String? { try await send(command: HGET(key: key, field: field)) } /// Returns all fields and values in a hash. /// - /// - Documentation: [HGETALL](https:/redis.io/docs/latest/commands/hgetall) + /// - Documentation: [HGETALL](https:/valkey.io/commands/hgetall) /// - Version: 2.0.0 /// - Complexity: O(N) where N is the size of the hash. /// - Categories: @read, @hash, @slow - /// - Returns: [Map](https:/redis.io/docs/reference/protocol-spec#maps): a map of fields and their values stored in the hash, or an empty list when key does not exist. + /// - Returns: [Map](https:/valkey.io/topics/protocol/#maps): a map of fields and their values stored in the hash, or an empty list when key does not exist. @inlinable - public func hgetall(key: RedisKey) async throws -> [String: RESPToken] { + public func hgetall(key: RESPKey) async throws -> [String: RESPToken] { try await send(command: HGETALL(key: key)) } /// Increments the integer value of a field in a hash by a number. Uses 0 as initial value if the field doesn't exist. /// - /// - Documentation: [HINCRBY](https:/redis.io/docs/latest/commands/hincrby) + /// - Documentation: [HINCRBY](https:/valkey.io/commands/hincrby) /// - Version: 2.0.0 /// - Complexity: O(1) /// - Categories: @write, @hash, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the value of the field after the increment operation. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the value of the field after the increment operation. @inlinable - public func hincrby(key: RedisKey, field: String, increment: Int) async throws -> Int { + public func hincrby(key: RESPKey, field: String, increment: Int) async throws -> Int { try await send(command: HINCRBY(key: key, field: field, increment: increment)) } /// Increments the floating point value of a field by a number. Uses 0 as initial value if the field doesn't exist. /// - /// - Documentation: [HINCRBYFLOAT](https:/redis.io/docs/latest/commands/hincrbyfloat) + /// - Documentation: [HINCRBYFLOAT](https:/valkey.io/commands/hincrbyfloat) /// - Version: 2.6.0 /// - Complexity: O(1) /// - Categories: @write, @hash, @fast - /// - Returns: [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): The value of the field after the increment operation. + /// - Returns: [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): the value of the field after the increment operation. @inlinable - public func hincrbyfloat(key: RedisKey, field: String, increment: Double) async throws -> String { + public func hincrbyfloat(key: RESPKey, field: String, increment: Double) async throws -> String { try await send(command: HINCRBYFLOAT(key: key, field: field, increment: increment)) } /// Returns all fields in a hash. /// - /// - Documentation: [HKEYS](https:/redis.io/docs/latest/commands/hkeys) + /// - Documentation: [HKEYS](https:/valkey.io/commands/hkeys) /// - Version: 2.0.0 /// - Complexity: O(N) where N is the size of the hash. /// - Categories: @read, @hash, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of fields in the hash, or an empty list when the key does not exist. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of fields in the hash, or an empty list when the key does not exist. @inlinable - public func hkeys(key: RedisKey) async throws -> [RESPToken] { + public func hkeys(key: RESPKey) async throws -> [RESPToken] { try await send(command: HKEYS(key: key)) } /// Returns the number of fields in a hash. /// - /// - Documentation: [HLEN](https:/redis.io/docs/latest/commands/hlen) + /// - Documentation: [HLEN](https:/valkey.io/commands/hlen) /// - Version: 2.0.0 /// - Complexity: O(1) /// - Categories: @read, @hash, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of the fields in the hash, or 0 when the key does not exist. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of fields in the hash, or 0 when the key does not exist. @inlinable - public func hlen(key: RedisKey) async throws -> Int { + public func hlen(key: RESPKey) async throws -> Int { try await send(command: HLEN(key: key)) } /// Returns the values of all fields in a hash. /// - /// - Documentation: [HMGET](https:/redis.io/docs/latest/commands/hmget) + /// - Documentation: [HMGET](https:/valkey.io/commands/hmget) /// - Version: 2.0.0 /// - Complexity: O(N) where N is the number of fields being requested. /// - Categories: @read, @hash, @fast - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of values associated with the given fields, in the same order as they are requested. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of values associated with the given fields, in the same order as they are requested. @inlinable - public func hmget(key: RedisKey, field: [String]) async throws -> [RESPToken] { + public func hmget(key: RESPKey, field: [String]) async throws -> [RESPToken] { try await send(command: HMGET(key: key, field: field)) } /// Sets the values of multiple fields. /// - /// - Documentation: [HMSET](https:/redis.io/docs/latest/commands/hmset) + /// - Documentation: [HMSET](https:/valkey.io/commands/hmset) /// - Version: 2.0.0 /// - Complexity: O(N) where N is the number of fields being set. /// - Categories: @write, @hash, @fast - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable - public func hmset(key: RedisKey, data: [HMSET.Data]) async throws -> RESPToken { + public func hmset(key: RESPKey, data: [HMSET.Data]) async throws -> RESPToken { try await send(command: HMSET(key: key, data: data)) } /// Returns one or more random fields from a hash. /// - /// - Documentation: [HRANDFIELD](https:/redis.io/docs/latest/commands/hrandfield) + /// - Documentation: [HRANDFIELD](https:/valkey.io/commands/hrandfield) /// - Version: 6.2.0 /// - Complexity: O(N) where N is the number of fields returned /// - Categories: @read, @hash, @slow /// - Returns: Any of the following: - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): if the key doesn't exist - /// * [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): a single, randomly selected field when the `count` option is not used - /// * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list containing `count` fields when the `count` option is used, or an empty array if the key does not exists. - /// * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of fields and their values when `count` and `WITHVALUES` were both used. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): if the key doesn't exist + /// * [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): a single, randomly selected field when the `count` option is not used + /// * [Array](https:/valkey.io/topics/protocol/#arrays): a list containing `count` fields when the `count` option is used, or an empty array if the key does not exists. + /// * [Array](https:/valkey.io/topics/protocol/#arrays): a list of fields and their values when `count` and `WITHVALUES` were both used. @inlinable - public func hrandfield(key: RedisKey, options: HRANDFIELD.Options? = nil) async throws -> RESPToken { + public func hrandfield(key: RESPKey, options: HRANDFIELD.Options? = nil) async throws -> RESPToken { try await send(command: HRANDFIELD(key: key, options: options)) } /// Iterates over fields and values of a hash. /// - /// - Documentation: [HSCAN](https:/redis.io/docs/latest/commands/hscan) + /// - Documentation: [HSCAN](https:/valkey.io/commands/hscan) /// - Version: 2.8.0 /// - Complexity: O(1) for every call. O(N) for a complete iteration, including enough command calls for the cursor to return back to 0. N is the number of elements inside the collection. /// - Categories: @read, @hash, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a two-element array. - /// * The first element is a [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings) that represents an unsigned 64-bit number, the cursor. - /// * The second element is an [Array](https:/redis.io/docs/reference/protocol-spec#arrays) of field/value pairs that were scanned. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a two-element array. + /// * The first element is a [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings) that represents an unsigned 64-bit number, the cursor. + /// * The second element is an [Array](https:/valkey.io/topics/protocol/#arrays) of field/value pairs that were scanned. When `NOVALUES` option is on, a list of keys from the hash. @inlinable - public func hscan(key: RedisKey, cursor: Int, pattern: String? = nil, count: Int? = nil) async throws -> [RESPToken] { + public func hscan(key: RESPKey, cursor: Int, pattern: String? = nil, count: Int? = nil) async throws -> [RESPToken] { try await send(command: HSCAN(key: key, cursor: cursor, pattern: pattern, count: count)) } /// Creates or modifies the value of a field in a hash. /// - /// - Documentation: [HSET](https:/redis.io/docs/latest/commands/hset) + /// - Documentation: [HSET](https:/valkey.io/commands/hset) /// - Version: 2.0.0 /// - Complexity: O(1) for each field/value pair added, so O(N) to add N field/value pairs when the command is called with multiple field/value pairs. /// - Categories: @write, @hash, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of fields that were added. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of fields that were added. @inlinable - public func hset(key: RedisKey, data: [HSET.Data]) async throws -> Int { + public func hset(key: RESPKey, data: [HSET.Data]) async throws -> Int { try await send(command: HSET(key: key, data: data)) } /// Sets the value of a field in a hash only when the field doesn't exist. /// - /// - Documentation: [HSETNX](https:/redis.io/docs/latest/commands/hsetnx) + /// - Documentation: [HSETNX](https:/valkey.io/commands/hsetnx) /// - Version: 2.0.0 /// - Complexity: O(1) /// - Categories: @write, @hash, @fast /// - Returns: One of the following: - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `0` if the field already exists in the hash and no operation was performed. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `1` if the field is a new field in the hash and the value was set. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `0` if the field already exists in the hash and no operation was performed. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `1` if the field is a new field in the hash and the value was set. @inlinable - public func hsetnx(key: RedisKey, field: String, value: String) async throws -> Int { + public func hsetnx(key: RESPKey, field: String, value: String) async throws -> Int { try await send(command: HSETNX(key: key, field: field, value: value)) } /// Returns the length of the value of a field. /// - /// - Documentation: [HSTRLEN](https:/redis.io/docs/latest/commands/hstrlen) + /// - Documentation: [HSTRLEN](https:/valkey.io/commands/hstrlen) /// - Version: 3.2.0 /// - Complexity: O(1) /// - Categories: @read, @hash, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the string length of the value associated with the _field_, or zero when the _field_ isn't present in the hash or the _key_ doesn't exist at all. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the string length of the value associated with the _field_, or zero when the _field_ isn't present in the hash or the _key_ doesn't exist at all. @inlinable - public func hstrlen(key: RedisKey, field: String) async throws -> Int { + public func hstrlen(key: RESPKey, field: String) async throws -> Int { try await send(command: HSTRLEN(key: key, field: field)) } /// Returns all values in a hash. /// - /// - Documentation: [HVALS](https:/redis.io/docs/latest/commands/hvals) + /// - Documentation: [HVALS](https:/valkey.io/commands/hvals) /// - Version: 2.0.0 /// - Complexity: O(N) where N is the size of the hash. /// - Categories: @read, @hash, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of values in the hash, or an empty list when the key does not exist. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of values in the hash, or an empty list when the key does not exist. @inlinable - public func hvals(key: RedisKey) async throws -> [RESPToken] { + public func hvals(key: RESPKey) async throws -> [RESPToken] { try await send(command: HVALS(key: key)) } diff --git a/Sources/RedisCommands/HyperloglogCommands.swift b/Sources/Valkey/Commands/HyperloglogCommands.swift similarity index 54% rename from Sources/RedisCommands/HyperloglogCommands.swift rename to Sources/Valkey/Commands/HyperloglogCommands.swift index d4467a1d..61afa9c5 100644 --- a/Sources/RedisCommands/HyperloglogCommands.swift +++ b/Sources/Valkey/Commands/HyperloglogCommands.swift @@ -1,21 +1,20 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -// This file is autogenerated by RedisCommandsBuilder +// This file is autogenerated by ValkeyCommandsBuilder import NIOCore -import Redis #if canImport(FoundationEssentials) import FoundationEssentials @@ -24,114 +23,114 @@ import Foundation #endif /// Adds elements to a HyperLogLog key. Creates the key if it doesn't exist. -public struct PFADD: RedisCommand { +public struct PFADD: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var element: [String] = [] - @inlinable public init(key: RedisKey, element: [String] = []) { + @inlinable public init(key: RESPKey, element: [String] = []) { self.key = key self.element = element } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("PFADD", key, element) } } /// Returns the approximated cardinality of the set(s) observed by the HyperLogLog key(s). -public struct PFCOUNT: RedisCommand { +public struct PFCOUNT: RESPCommand { public typealias Response = Int - public var key: [RedisKey] + public var key: [RESPKey] - @inlinable public init(key: [RedisKey]) { + @inlinable public init(key: [RESPKey]) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("PFCOUNT", key) } } /// Merges one or more HyperLogLog values into a single key. -public struct PFMERGE: RedisCommand { +public struct PFMERGE: RESPCommand { public typealias Response = RESPToken - public var destkey: RedisKey - public var sourcekey: [RedisKey] = [] + public var destkey: RESPKey + public var sourcekey: [RESPKey] = [] - @inlinable public init(destkey: RedisKey, sourcekey: [RedisKey] = []) { + @inlinable public init(destkey: RESPKey, sourcekey: [RESPKey] = []) { self.destkey = destkey self.sourcekey = sourcekey } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("PFMERGE", destkey, sourcekey) } } /// An internal command for testing HyperLogLog values. -public struct PFSELFTEST: RedisCommand { +public struct PFSELFTEST: RESPCommand { public typealias Response = RESPToken @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("PFSELFTEST") } } -extension RedisConnection { +extension ValkeyConnection { /// Adds elements to a HyperLogLog key. Creates the key if it doesn't exist. /// - /// - Documentation: [PFADD](https:/redis.io/docs/latest/commands/pfadd) + /// - Documentation: [PFADD](https:/valkey.io/commands/pfadd) /// - Version: 2.8.9 /// - Complexity: O(1) to add every element. /// - Categories: @write, @hyperloglog, @fast /// - Returns: One of the following: - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `1` if at least one HyperLogLog internal register was altered. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `0` if no HyperLogLog internal registers were altered. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `1` if at least one HyperLogLog internal register was altered. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `0` if no HyperLogLog internal registers were altered. @inlinable - public func pfadd(key: RedisKey, element: [String] = []) async throws -> Int { + public func pfadd(key: RESPKey, element: [String] = []) async throws -> Int { try await send(command: PFADD(key: key, element: element)) } /// Returns the approximated cardinality of the set(s) observed by the HyperLogLog key(s). /// - /// - Documentation: [PFCOUNT](https:/redis.io/docs/latest/commands/pfcount) + /// - Documentation: [PFCOUNT](https:/valkey.io/commands/pfcount) /// - Version: 2.8.9 /// - Complexity: O(1) with a very small average constant time when called with a single key. O(N) with N being the number of keys, and much bigger constant times, when called with multiple keys. /// - Categories: @read, @hyperloglog, @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the approximated number of unique elements observed via `PFADD` + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the approximated number of unique elements observed via `PFADD`. @inlinable - public func pfcount(key: [RedisKey]) async throws -> Int { + public func pfcount(key: [RESPKey]) async throws -> Int { try await send(command: PFCOUNT(key: key)) } /// Merges one or more HyperLogLog values into a single key. /// - /// - Documentation: [PFMERGE](https:/redis.io/docs/latest/commands/pfmerge) + /// - Documentation: [PFMERGE](https:/valkey.io/commands/pfmerge) /// - Version: 2.8.9 /// - Complexity: O(N) to merge N HyperLogLogs, but with high constant times. /// - Categories: @write, @hyperloglog, @slow - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable - public func pfmerge(destkey: RedisKey, sourcekey: [RedisKey] = []) async throws -> RESPToken { + public func pfmerge(destkey: RESPKey, sourcekey: [RESPKey] = []) async throws -> RESPToken { try await send(command: PFMERGE(destkey: destkey, sourcekey: sourcekey)) } /// An internal command for testing HyperLogLog values. /// - /// - Documentation: [PFSELFTEST](https:/redis.io/docs/latest/commands/pfselftest) + /// - Documentation: [PFSELFTEST](https:/valkey.io/commands/pfselftest) /// - Version: 2.8.9 /// - Complexity: N/A /// - Categories: @hyperloglog, @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func pfselftest() async throws -> RESPToken { try await send(command: PFSELFTEST()) diff --git a/Sources/RedisCommands/ListCommands.swift b/Sources/Valkey/Commands/ListCommands.swift similarity index 56% rename from Sources/RedisCommands/ListCommands.swift rename to Sources/Valkey/Commands/ListCommands.swift index 3e1919d9..e5b8f929 100644 --- a/Sources/RedisCommands/ListCommands.swift +++ b/Sources/Valkey/Commands/ListCommands.swift @@ -1,21 +1,20 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -// This file is autogenerated by RedisCommandsBuilder +// This file is autogenerated by ValkeyCommandsBuilder import NIOCore -import Redis #if canImport(FoundationEssentials) import FoundationEssentials @@ -24,13 +23,13 @@ import Foundation #endif /// Pops an element from a list, pushes it to another list and returns it. Blocks until an element is available otherwise. Deletes the list if the last element was moved. -public struct BLMOVE: RedisCommand { +public struct BLMOVE: RESPCommand { public enum Wherefrom: RESPRenderable { case left case right @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .left: "LEFT".encode(into: &commandEncoder) case .right: "RIGHT".encode(into: &commandEncoder) @@ -42,7 +41,7 @@ public struct BLMOVE: RedisCommand { case right @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .left: "LEFT".encode(into: &commandEncoder) case .right: "RIGHT".encode(into: &commandEncoder) @@ -51,13 +50,13 @@ public struct BLMOVE: RedisCommand { } public typealias Response = String? - public var source: RedisKey - public var destination: RedisKey + public var source: RESPKey + public var destination: RESPKey public var wherefrom: Wherefrom public var whereto: Whereto public var timeout: Double - @inlinable public init(source: RedisKey, destination: RedisKey, wherefrom: Wherefrom, whereto: Whereto, timeout: Double) { + @inlinable public init(source: RESPKey, destination: RESPKey, wherefrom: Wherefrom, whereto: Whereto, timeout: Double) { self.source = source self.destination = destination self.wherefrom = wherefrom @@ -65,19 +64,19 @@ public struct BLMOVE: RedisCommand { self.timeout = timeout } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("BLMOVE", source, destination, wherefrom, whereto, timeout) } } /// Pops the first element from one of multiple lists. Blocks until an element is available otherwise. Deletes the list if the last element was popped. -public struct BLMPOP: RedisCommand { +public struct BLMPOP: RESPCommand { public enum Where: RESPRenderable { case left case right @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .left: "LEFT".encode(into: &commandEncoder) case .right: "RIGHT".encode(into: &commandEncoder) @@ -87,100 +86,100 @@ public struct BLMPOP: RedisCommand { public typealias Response = [RESPToken]? public var timeout: Double - public var key: [RedisKey] + public var key: [RESPKey] public var `where`: Where public var count: Int? = nil - @inlinable public init(timeout: Double, key: [RedisKey], `where`: Where, count: Int? = nil) { + @inlinable public init(timeout: Double, key: [RESPKey], `where`: Where, count: Int? = nil) { self.timeout = timeout self.key = key self.`where` = `where` self.count = count } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("BLMPOP", timeout, RESPArrayWithCount(key), `where`, RESPWithToken("COUNT", count)) } } /// Removes and returns the first element in a list. Blocks until an element is available otherwise. Deletes the list if the last element was popped. -public struct BLPOP: RedisCommand { +public struct BLPOP: RESPCommand { public typealias Response = [RESPToken]? - public var key: [RedisKey] + public var key: [RESPKey] public var timeout: Double - @inlinable public init(key: [RedisKey], timeout: Double) { + @inlinable public init(key: [RESPKey], timeout: Double) { self.key = key self.timeout = timeout } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("BLPOP", key, timeout) } } /// Removes and returns the last element in a list. Blocks until an element is available otherwise. Deletes the list if the last element was popped. -public struct BRPOP: RedisCommand { +public struct BRPOP: RESPCommand { public typealias Response = [RESPToken]? - public var key: [RedisKey] + public var key: [RESPKey] public var timeout: Double - @inlinable public init(key: [RedisKey], timeout: Double) { + @inlinable public init(key: [RESPKey], timeout: Double) { self.key = key self.timeout = timeout } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("BRPOP", key, timeout) } } /// Pops an element from a list, pushes it to another list and returns it. Block until an element is available otherwise. Deletes the list if the last element was popped. -public struct BRPOPLPUSH: RedisCommand { +public struct BRPOPLPUSH: RESPCommand { public typealias Response = String? - public var source: RedisKey - public var destination: RedisKey + public var source: RESPKey + public var destination: RESPKey public var timeout: Double - @inlinable public init(source: RedisKey, destination: RedisKey, timeout: Double) { + @inlinable public init(source: RESPKey, destination: RESPKey, timeout: Double) { self.source = source self.destination = destination self.timeout = timeout } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("BRPOPLPUSH", source, destination, timeout) } } /// Returns an element from a list by its index. -public struct LINDEX: RedisCommand { +public struct LINDEX: RESPCommand { public typealias Response = String? - public var key: RedisKey + public var key: RESPKey public var index: Int - @inlinable public init(key: RedisKey, index: Int) { + @inlinable public init(key: RESPKey, index: Int) { self.key = key self.index = index } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("LINDEX", key, index) } } /// Inserts an element before or after another element in a list. -public struct LINSERT: RedisCommand { +public struct LINSERT: RESPCommand { public enum Where: RESPRenderable { case before case after @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .before: "BEFORE".encode(into: &commandEncoder) case .after: "AFTER".encode(into: &commandEncoder) @@ -189,46 +188,46 @@ public struct LINSERT: RedisCommand { } public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var `where`: Where public var pivot: String public var element: String - @inlinable public init(key: RedisKey, `where`: Where, pivot: String, element: String) { + @inlinable public init(key: RESPKey, `where`: Where, pivot: String, element: String) { self.key = key self.`where` = `where` self.pivot = pivot self.element = element } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("LINSERT", key, `where`, pivot, element) } } /// Returns the length of a list. -public struct LLEN: RedisCommand { +public struct LLEN: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey - @inlinable public init(key: RedisKey) { + @inlinable public init(key: RESPKey) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("LLEN", key) } } /// Returns an element after popping it from one list and pushing it to another. Deletes the list if the last element was moved. -public struct LMOVE: RedisCommand { +public struct LMOVE: RESPCommand { public enum Wherefrom: RESPRenderable { case left case right @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .left: "LEFT".encode(into: &commandEncoder) case .right: "RIGHT".encode(into: &commandEncoder) @@ -240,7 +239,7 @@ public struct LMOVE: RedisCommand { case right @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .left: "LEFT".encode(into: &commandEncoder) case .right: "RIGHT".encode(into: &commandEncoder) @@ -249,31 +248,31 @@ public struct LMOVE: RedisCommand { } public typealias Response = String - public var source: RedisKey - public var destination: RedisKey + public var source: RESPKey + public var destination: RESPKey public var wherefrom: Wherefrom public var whereto: Whereto - @inlinable public init(source: RedisKey, destination: RedisKey, wherefrom: Wherefrom, whereto: Whereto) { + @inlinable public init(source: RESPKey, destination: RESPKey, wherefrom: Wherefrom, whereto: Whereto) { self.source = source self.destination = destination self.wherefrom = wherefrom self.whereto = whereto } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("LMOVE", source, destination, wherefrom, whereto) } } /// Returns multiple elements from a list after removing them. Deletes the list if the last element was popped. -public struct LMPOP: RedisCommand { +public struct LMPOP: RESPCommand { public enum Where: RESPRenderable { case left case right @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .left: "LEFT".encode(into: &commandEncoder) case .right: "RIGHT".encode(into: &commandEncoder) @@ -282,49 +281,49 @@ public struct LMPOP: RedisCommand { } public typealias Response = [RESPToken]? - public var key: [RedisKey] + public var key: [RESPKey] public var `where`: Where public var count: Int? = nil - @inlinable public init(key: [RedisKey], `where`: Where, count: Int? = nil) { + @inlinable public init(key: [RESPKey], `where`: Where, count: Int? = nil) { self.key = key self.`where` = `where` self.count = count } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("LMPOP", RESPArrayWithCount(key), `where`, RESPWithToken("COUNT", count)) } } /// Returns the first elements in a list after removing it. Deletes the list if the last element was popped. -public struct LPOP: RedisCommand { +public struct LPOP: RESPCommand { public typealias Response = RESPToken - public var key: RedisKey + public var key: RESPKey public var count: Int? = nil - @inlinable public init(key: RedisKey, count: Int? = nil) { + @inlinable public init(key: RESPKey, count: Int? = nil) { self.key = key self.count = count } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("LPOP", key, count) } } /// Returns the index of matching elements in a list. -public struct LPOS: RedisCommand { +public struct LPOS: RESPCommand { public typealias Response = RESPToken - public var key: RedisKey + public var key: RESPKey public var element: String public var rank: Int? = nil public var numMatches: Int? = nil public var len: Int? = nil - @inlinable public init(key: RedisKey, element: String, rank: Int? = nil, numMatches: Int? = nil, len: Int? = nil) { + @inlinable public init(key: RESPKey, element: String, rank: Int? = nil, numMatches: Int? = nil, len: Int? = nil) { self.key = key self.element = element self.rank = rank @@ -332,480 +331,480 @@ public struct LPOS: RedisCommand { self.len = len } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("LPOS", key, element, RESPWithToken("RANK", rank), RESPWithToken("COUNT", numMatches), RESPWithToken("MAXLEN", len)) } } /// Prepends one or more elements to a list. Creates the key if it doesn't exist. -public struct LPUSH: RedisCommand { +public struct LPUSH: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var element: [String] - @inlinable public init(key: RedisKey, element: [String]) { + @inlinable public init(key: RESPKey, element: [String]) { self.key = key self.element = element } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("LPUSH", key, element) } } /// Prepends one or more elements to a list only when the list exists. -public struct LPUSHX: RedisCommand { +public struct LPUSHX: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var element: [String] - @inlinable public init(key: RedisKey, element: [String]) { + @inlinable public init(key: RESPKey, element: [String]) { self.key = key self.element = element } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("LPUSHX", key, element) } } /// Returns a range of elements from a list. -public struct LRANGE: RedisCommand { +public struct LRANGE: RESPCommand { public typealias Response = [RESPToken] - public var key: RedisKey + public var key: RESPKey public var start: Int public var stop: Int - @inlinable public init(key: RedisKey, start: Int, stop: Int) { + @inlinable public init(key: RESPKey, start: Int, stop: Int) { self.key = key self.start = start self.stop = stop } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("LRANGE", key, start, stop) } } /// Removes elements from a list. Deletes the list if the last element was removed. -public struct LREM: RedisCommand { +public struct LREM: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var count: Int public var element: String - @inlinable public init(key: RedisKey, count: Int, element: String) { + @inlinable public init(key: RESPKey, count: Int, element: String) { self.key = key self.count = count self.element = element } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("LREM", key, count, element) } } /// Sets the value of an element in a list by its index. -public struct LSET: RedisCommand { +public struct LSET: RESPCommand { public typealias Response = RESPToken - public var key: RedisKey + public var key: RESPKey public var index: Int public var element: String - @inlinable public init(key: RedisKey, index: Int, element: String) { + @inlinable public init(key: RESPKey, index: Int, element: String) { self.key = key self.index = index self.element = element } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("LSET", key, index, element) } } /// Removes elements from both ends a list. Deletes the list if all elements were trimmed. -public struct LTRIM: RedisCommand { +public struct LTRIM: RESPCommand { public typealias Response = RESPToken - public var key: RedisKey + public var key: RESPKey public var start: Int public var stop: Int - @inlinable public init(key: RedisKey, start: Int, stop: Int) { + @inlinable public init(key: RESPKey, start: Int, stop: Int) { self.key = key self.start = start self.stop = stop } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("LTRIM", key, start, stop) } } /// Returns and removes the last elements of a list. Deletes the list if the last element was popped. -public struct RPOP: RedisCommand { +public struct RPOP: RESPCommand { public typealias Response = RESPToken - public var key: RedisKey + public var key: RESPKey public var count: Int? = nil - @inlinable public init(key: RedisKey, count: Int? = nil) { + @inlinable public init(key: RESPKey, count: Int? = nil) { self.key = key self.count = count } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("RPOP", key, count) } } /// Returns the last element of a list after removing and pushing it to another list. Deletes the list if the last element was popped. -public struct RPOPLPUSH: RedisCommand { +public struct RPOPLPUSH: RESPCommand { public typealias Response = String? - public var source: RedisKey - public var destination: RedisKey + public var source: RESPKey + public var destination: RESPKey - @inlinable public init(source: RedisKey, destination: RedisKey) { + @inlinable public init(source: RESPKey, destination: RESPKey) { self.source = source self.destination = destination } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("RPOPLPUSH", source, destination) } } /// Appends one or more elements to a list. Creates the key if it doesn't exist. -public struct RPUSH: RedisCommand { +public struct RPUSH: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var element: [String] - @inlinable public init(key: RedisKey, element: [String]) { + @inlinable public init(key: RESPKey, element: [String]) { self.key = key self.element = element } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("RPUSH", key, element) } } /// Appends an element to a list only when the list exists. -public struct RPUSHX: RedisCommand { +public struct RPUSHX: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var element: [String] - @inlinable public init(key: RedisKey, element: [String]) { + @inlinable public init(key: RESPKey, element: [String]) { self.key = key self.element = element } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("RPUSHX", key, element) } } -extension RedisConnection { +extension ValkeyConnection { /// Pops an element from a list, pushes it to another list and returns it. Blocks until an element is available otherwise. Deletes the list if the last element was moved. /// - /// - Documentation: [BLMOVE](https:/redis.io/docs/latest/commands/blmove) + /// - Documentation: [BLMOVE](https:/valkey.io/commands/blmove) /// - Version: 6.2.0 /// - Complexity: O(1) /// - Categories: @write, @list, @slow, @blocking /// - Returns: One of the following: - /// * [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): the element being popped from the _source_ and pushed to the _destination_. - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): the operation timed-out + /// * [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): the element being popped from the _source_ and pushed to the _destination_. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): the operation timed-out @inlinable - public func blmove(source: RedisKey, destination: RedisKey, wherefrom: BLMOVE.Wherefrom, whereto: BLMOVE.Whereto, timeout: Double) async throws -> String? { + public func blmove(source: RESPKey, destination: RESPKey, wherefrom: BLMOVE.Wherefrom, whereto: BLMOVE.Whereto, timeout: Double) async throws -> String? { try await send(command: BLMOVE(source: source, destination: destination, wherefrom: wherefrom, whereto: whereto, timeout: timeout)) } /// Pops the first element from one of multiple lists. Blocks until an element is available otherwise. Deletes the list if the last element was popped. /// - /// - Documentation: [BLMPOP](https:/redis.io/docs/latest/commands/blmpop) + /// - Documentation: [BLMPOP](https:/valkey.io/commands/blmpop) /// - Version: 7.0.0 /// - Complexity: O(N+M) where N is the number of provided keys and M is the number of elements returned. /// - Categories: @write, @list, @slow, @blocking /// - Returns: One of the following: - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): when no element could be popped and the _timeout_ is reached. - /// * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a two-element array with the first element being the name of the key from which elements were popped, and the second element being an array of the popped elements. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): when no element could be popped and the _timeout_ is reached. + /// * [Array](https:/valkey.io/topics/protocol/#arrays): a two-element array with the first element being the name of the key from which elements were popped, and the second element being an array of the popped elements. @inlinable - public func blmpop(timeout: Double, key: [RedisKey], `where`: BLMPOP.Where, count: Int? = nil) async throws -> [RESPToken]? { + public func blmpop(timeout: Double, key: [RESPKey], `where`: BLMPOP.Where, count: Int? = nil) async throws -> [RESPToken]? { try await send(command: BLMPOP(timeout: timeout, key: key, where: `where`, count: count)) } /// Removes and returns the first element in a list. Blocks until an element is available otherwise. Deletes the list if the last element was popped. /// - /// - Documentation: [BLPOP](https:/redis.io/docs/latest/commands/blpop) + /// - Documentation: [BLPOP](https:/valkey.io/commands/blpop) /// - Version: 2.0.0 /// - Complexity: O(N) where N is the number of provided keys. /// - Categories: @write, @list, @slow, @blocking /// - Returns: One of the following: - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): no element could be popped and the timeout expired - /// * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): the key from which the element was popped and the value of the popped element. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): no element could be popped and the timeout expired + /// * [Array](https:/valkey.io/topics/protocol/#arrays): the key from which the element was popped and the value of the popped element. @inlinable - public func blpop(key: [RedisKey], timeout: Double) async throws -> [RESPToken]? { + public func blpop(key: [RESPKey], timeout: Double) async throws -> [RESPToken]? { try await send(command: BLPOP(key: key, timeout: timeout)) } /// Removes and returns the last element in a list. Blocks until an element is available otherwise. Deletes the list if the last element was popped. /// - /// - Documentation: [BRPOP](https:/redis.io/docs/latest/commands/brpop) + /// - Documentation: [BRPOP](https:/valkey.io/commands/brpop) /// - Version: 2.0.0 /// - Complexity: O(N) where N is the number of provided keys. /// - Categories: @write, @list, @slow, @blocking /// - Returns: One of the following: - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): no element could be popped and the timeout expired. - /// * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): the key from which the element was popped and the value of the popped element + /// * [Null](https:/valkey.io/topics/protocol/#nulls): no element could be popped and the timeout expired. + /// * [Array](https:/valkey.io/topics/protocol/#arrays): the key from which the element was popped and the value of the popped element @inlinable - public func brpop(key: [RedisKey], timeout: Double) async throws -> [RESPToken]? { + public func brpop(key: [RESPKey], timeout: Double) async throws -> [RESPToken]? { try await send(command: BRPOP(key: key, timeout: timeout)) } /// Pops an element from a list, pushes it to another list and returns it. Block until an element is available otherwise. Deletes the list if the last element was popped. /// - /// - Documentation: [BRPOPLPUSH](https:/redis.io/docs/latest/commands/brpoplpush) + /// - Documentation: [BRPOPLPUSH](https:/valkey.io/commands/brpoplpush) /// - Version: 2.2.0 /// - Complexity: O(1) /// - Categories: @write, @list, @slow, @blocking /// - Returns: One of the following: - /// * [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): the element being popped from _source_ and pushed to _destination_. - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): the timeout is reached. + /// * [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): the element being popped from _source_ and pushed to _destination_. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): the timeout is reached. @inlinable - public func brpoplpush(source: RedisKey, destination: RedisKey, timeout: Double) async throws -> String? { + public func brpoplpush(source: RESPKey, destination: RESPKey, timeout: Double) async throws -> String? { try await send(command: BRPOPLPUSH(source: source, destination: destination, timeout: timeout)) } /// Returns an element from a list by its index. /// - /// - Documentation: [LINDEX](https:/redis.io/docs/latest/commands/lindex) + /// - Documentation: [LINDEX](https:/valkey.io/commands/lindex) /// - Version: 1.0.0 /// - Complexity: O(N) where N is the number of elements to traverse to get to the element at index. This makes asking for the first or the last element of the list O(1). /// - Categories: @read, @list, @slow /// - Returns: One of the following: - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): when _index_ is out of range. - /// * [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): the requested element. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): when _index_ is out of range. + /// * [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): the requested element. @inlinable - public func lindex(key: RedisKey, index: Int) async throws -> String? { + public func lindex(key: RESPKey, index: Int) async throws -> String? { try await send(command: LINDEX(key: key, index: index)) } /// Inserts an element before or after another element in a list. /// - /// - Documentation: [LINSERT](https:/redis.io/docs/latest/commands/linsert) + /// - Documentation: [LINSERT](https:/valkey.io/commands/linsert) /// - Version: 2.2.0 /// - Complexity: O(N) where N is the number of elements to traverse before seeing the value pivot. This means that inserting somewhere on the left end on the list (head) can be considered O(1) and inserting somewhere on the right end (tail) is O(N). /// - Categories: @write, @list, @slow /// - Returns: One of the following: - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the list length after a successful insert operation. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `0` when the key doesn't exist. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `-1` when the pivot wasn't found. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): the list length after a successful insert operation. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `0` when the key doesn't exist. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `-1` when the pivot wasn't found. @inlinable - public func linsert(key: RedisKey, `where`: LINSERT.Where, pivot: String, element: String) async throws -> Int { + public func linsert(key: RESPKey, `where`: LINSERT.Where, pivot: String, element: String) async throws -> Int { try await send(command: LINSERT(key: key, where: `where`, pivot: pivot, element: element)) } /// Returns the length of a list. /// - /// - Documentation: [LLEN](https:/redis.io/docs/latest/commands/llen) + /// - Documentation: [LLEN](https:/valkey.io/commands/llen) /// - Version: 1.0.0 /// - Complexity: O(1) /// - Categories: @read, @list, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the length of the list. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the length of the list. @inlinable - public func llen(key: RedisKey) async throws -> Int { + public func llen(key: RESPKey) async throws -> Int { try await send(command: LLEN(key: key)) } /// Returns an element after popping it from one list and pushing it to another. Deletes the list if the last element was moved. /// - /// - Documentation: [LMOVE](https:/redis.io/docs/latest/commands/lmove) + /// - Documentation: [LMOVE](https:/valkey.io/commands/lmove) /// - Version: 6.2.0 /// - Complexity: O(1) /// - Categories: @write, @list, @slow - /// - Returns: [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): the element being popped and pushed. + /// - Returns: [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): the element being popped and pushed. @inlinable - public func lmove(source: RedisKey, destination: RedisKey, wherefrom: LMOVE.Wherefrom, whereto: LMOVE.Whereto) async throws -> String { + public func lmove(source: RESPKey, destination: RESPKey, wherefrom: LMOVE.Wherefrom, whereto: LMOVE.Whereto) async throws -> String { try await send(command: LMOVE(source: source, destination: destination, wherefrom: wherefrom, whereto: whereto)) } /// Returns multiple elements from a list after removing them. Deletes the list if the last element was popped. /// - /// - Documentation: [LMPOP](https:/redis.io/docs/latest/commands/lmpop) + /// - Documentation: [LMPOP](https:/valkey.io/commands/lmpop) /// - Version: 7.0.0 /// - Complexity: O(N+M) where N is the number of provided keys and M is the number of elements returned. /// - Categories: @write, @list, @slow /// - Returns: One of the following: - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): if no element could be popped. - /// * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a two-element array with the first element being the name of the key from which elements were popped and the second element being an array of elements. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): if no element could be popped. + /// * [Array](https:/valkey.io/topics/protocol/#arrays): a two-element array with the first element being the name of the key from which elements were popped and the second element being an array of elements. @inlinable - public func lmpop(key: [RedisKey], `where`: LMPOP.Where, count: Int? = nil) async throws -> [RESPToken]? { + public func lmpop(key: [RESPKey], `where`: LMPOP.Where, count: Int? = nil) async throws -> [RESPToken]? { try await send(command: LMPOP(key: key, where: `where`, count: count)) } /// Returns the first elements in a list after removing it. Deletes the list if the last element was popped. /// - /// - Documentation: [LPOP](https:/redis.io/docs/latest/commands/lpop) + /// - Documentation: [LPOP](https:/valkey.io/commands/lpop) /// - Version: 1.0.0 /// - Complexity: O(N) where N is the number of elements returned /// - Categories: @write, @list, @fast /// - Returns: One of the following: - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): if the key does not exist. - /// * [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): when called without the _count_ argument, the value of the first element. - /// * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): when called with the _count_ argument, a list of popped elements. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): if the key does not exist. + /// * [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): when called without the _count_ argument, the value of the first element. + /// * [Array](https:/valkey.io/topics/protocol/#arrays): when called with the _count_ argument, a list of popped elements. @inlinable - public func lpop(key: RedisKey, count: Int? = nil) async throws -> RESPToken { + public func lpop(key: RESPKey, count: Int? = nil) async throws -> RESPToken { try await send(command: LPOP(key: key, count: count)) } /// Returns the index of matching elements in a list. /// - /// - Documentation: [LPOS](https:/redis.io/docs/latest/commands/lpos) + /// - Documentation: [LPOS](https:/valkey.io/commands/lpos) /// - Version: 6.0.6 /// - Complexity: O(N) where N is the number of elements in the list, for the average case. When searching for elements near the head or the tail of the list, or when the MAXLEN option is provided, the command may run in constant time. /// - Categories: @read, @list, @slow /// - Returns: Any of the following: - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): if there is no matching element. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): an integer representing the matching element. - /// * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): If the COUNT option is given, an array of integers representing the matching elements (or an empty array if there are no matches). + /// * [Null](https:/valkey.io/topics/protocol/#nulls): if there is no matching element. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): an integer representing the matching element. + /// * [Array](https:/valkey.io/topics/protocol/#arrays): If the COUNT option is given, an array of integers representing the matching elements (or an empty array if there are no matches). @inlinable - public func lpos(key: RedisKey, element: String, rank: Int? = nil, numMatches: Int? = nil, len: Int? = nil) async throws -> RESPToken { + public func lpos(key: RESPKey, element: String, rank: Int? = nil, numMatches: Int? = nil, len: Int? = nil) async throws -> RESPToken { try await send(command: LPOS(key: key, element: element, rank: rank, numMatches: numMatches, len: len)) } /// Prepends one or more elements to a list. Creates the key if it doesn't exist. /// - /// - Documentation: [LPUSH](https:/redis.io/docs/latest/commands/lpush) + /// - Documentation: [LPUSH](https:/valkey.io/commands/lpush) /// - Version: 1.0.0 /// - Complexity: O(1) for each element added, so O(N) to add N elements when the command is called with multiple arguments. /// - Categories: @write, @list, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the length of the list after the push operation. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the length of the list after the push operation. @inlinable - public func lpush(key: RedisKey, element: [String]) async throws -> Int { + public func lpush(key: RESPKey, element: [String]) async throws -> Int { try await send(command: LPUSH(key: key, element: element)) } /// Prepends one or more elements to a list only when the list exists. /// - /// - Documentation: [LPUSHX](https:/redis.io/docs/latest/commands/lpushx) + /// - Documentation: [LPUSHX](https:/valkey.io/commands/lpushx) /// - Version: 2.2.0 /// - Complexity: O(1) for each element added, so O(N) to add N elements when the command is called with multiple arguments. /// - Categories: @write, @list, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the length of the list after the push operation. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the length of the list after the push operation. @inlinable - public func lpushx(key: RedisKey, element: [String]) async throws -> Int { + public func lpushx(key: RESPKey, element: [String]) async throws -> Int { try await send(command: LPUSHX(key: key, element: element)) } /// Returns a range of elements from a list. /// - /// - Documentation: [LRANGE](https:/redis.io/docs/latest/commands/lrange) + /// - Documentation: [LRANGE](https:/valkey.io/commands/lrange) /// - Version: 1.0.0 /// - Complexity: O(S+N) where S is the distance of start offset from HEAD for small lists, from nearest end (HEAD or TAIL) for large lists; and N is the number of elements in the specified range. /// - Categories: @read, @list, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of elements in the specified range, or an empty array if the key doesn't exist. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of elements in the specified range, or an empty array if the key doesn't exist. @inlinable - public func lrange(key: RedisKey, start: Int, stop: Int) async throws -> [RESPToken] { + public func lrange(key: RESPKey, start: Int, stop: Int) async throws -> [RESPToken] { try await send(command: LRANGE(key: key, start: start, stop: stop)) } /// Removes elements from a list. Deletes the list if the last element was removed. /// - /// - Documentation: [LREM](https:/redis.io/docs/latest/commands/lrem) + /// - Documentation: [LREM](https:/valkey.io/commands/lrem) /// - Version: 1.0.0 /// - Complexity: O(N+M) where N is the length of the list and M is the number of elements removed. /// - Categories: @write, @list, @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of removed elements. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of removed elements. @inlinable - public func lrem(key: RedisKey, count: Int, element: String) async throws -> Int { + public func lrem(key: RESPKey, count: Int, element: String) async throws -> Int { try await send(command: LREM(key: key, count: count, element: element)) } /// Sets the value of an element in a list by its index. /// - /// - Documentation: [LSET](https:/redis.io/docs/latest/commands/lset) + /// - Documentation: [LSET](https:/valkey.io/commands/lset) /// - Version: 1.0.0 /// - Complexity: O(N) where N is the length of the list. Setting either the first or the last element of the list is O(1). /// - Categories: @write, @list, @slow - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable - public func lset(key: RedisKey, index: Int, element: String) async throws -> RESPToken { + public func lset(key: RESPKey, index: Int, element: String) async throws -> RESPToken { try await send(command: LSET(key: key, index: index, element: element)) } /// Removes elements from both ends a list. Deletes the list if all elements were trimmed. /// - /// - Documentation: [LTRIM](https:/redis.io/docs/latest/commands/ltrim) + /// - Documentation: [LTRIM](https:/valkey.io/commands/ltrim) /// - Version: 1.0.0 /// - Complexity: O(N) where N is the number of elements to be removed by the operation. /// - Categories: @write, @list, @slow - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable - public func ltrim(key: RedisKey, start: Int, stop: Int) async throws -> RESPToken { + public func ltrim(key: RESPKey, start: Int, stop: Int) async throws -> RESPToken { try await send(command: LTRIM(key: key, start: start, stop: stop)) } /// Returns and removes the last elements of a list. Deletes the list if the last element was popped. /// - /// - Documentation: [RPOP](https:/redis.io/docs/latest/commands/rpop) + /// - Documentation: [RPOP](https:/valkey.io/commands/rpop) /// - Version: 1.0.0 /// - Complexity: O(N) where N is the number of elements returned /// - Categories: @write, @list, @fast /// - Returns: One of the following: - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): if the key does not exist. - /// * [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): when called without the _count_ argument, the value of the last element. - /// * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): when called with the _count_ argument, a list of popped elements. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): if the key does not exist. + /// * [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): when called without the _count_ argument, the value of the last element. + /// * [Array](https:/valkey.io/topics/protocol/#arrays): when called with the _count_ argument, a list of popped elements. @inlinable - public func rpop(key: RedisKey, count: Int? = nil) async throws -> RESPToken { + public func rpop(key: RESPKey, count: Int? = nil) async throws -> RESPToken { try await send(command: RPOP(key: key, count: count)) } /// Returns the last element of a list after removing and pushing it to another list. Deletes the list if the last element was popped. /// - /// - Documentation: [RPOPLPUSH](https:/redis.io/docs/latest/commands/rpoplpush) + /// - Documentation: [RPOPLPUSH](https:/valkey.io/commands/rpoplpush) /// - Version: 1.2.0 /// - Complexity: O(1) /// - Categories: @write, @list, @slow /// - Returns: One of the following: - /// * [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): the element being popped and pushed. - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): if the source list is empty. + /// * [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): the element being popped and pushed. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): if the source list is empty. @inlinable - public func rpoplpush(source: RedisKey, destination: RedisKey) async throws -> String? { + public func rpoplpush(source: RESPKey, destination: RESPKey) async throws -> String? { try await send(command: RPOPLPUSH(source: source, destination: destination)) } /// Appends one or more elements to a list. Creates the key if it doesn't exist. /// - /// - Documentation: [RPUSH](https:/redis.io/docs/latest/commands/rpush) + /// - Documentation: [RPUSH](https:/valkey.io/commands/rpush) /// - Version: 1.0.0 /// - Complexity: O(1) for each element added, so O(N) to add N elements when the command is called with multiple arguments. /// - Categories: @write, @list, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the length of the list after the push operation. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the length of the list after the push operation. @inlinable - public func rpush(key: RedisKey, element: [String]) async throws -> Int { + public func rpush(key: RESPKey, element: [String]) async throws -> Int { try await send(command: RPUSH(key: key, element: element)) } /// Appends an element to a list only when the list exists. /// - /// - Documentation: [RPUSHX](https:/redis.io/docs/latest/commands/rpushx) + /// - Documentation: [RPUSHX](https:/valkey.io/commands/rpushx) /// - Version: 2.2.0 /// - Complexity: O(1) for each element added, so O(N) to add N elements when the command is called with multiple arguments. /// - Categories: @write, @list, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the length of the list after the push operation. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the length of the list after the push operation. @inlinable - public func rpushx(key: RedisKey, element: [String]) async throws -> Int { + public func rpushx(key: RESPKey, element: [String]) async throws -> Int { try await send(command: RPUSHX(key: key, element: element)) } diff --git a/Sources/RedisCommands/PubsubCommands.swift b/Sources/Valkey/Commands/PubsubCommands.swift similarity index 72% rename from Sources/RedisCommands/PubsubCommands.swift rename to Sources/Valkey/Commands/PubsubCommands.swift index 7b4382b5..44988da6 100644 --- a/Sources/RedisCommands/PubsubCommands.swift +++ b/Sources/Valkey/Commands/PubsubCommands.swift @@ -1,21 +1,20 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -// This file is autogenerated by RedisCommandsBuilder +// This file is autogenerated by ValkeyCommandsBuilder import NIOCore -import Redis #if canImport(FoundationEssentials) import FoundationEssentials @@ -26,7 +25,7 @@ import Foundation /// A container for Pub/Sub commands. public enum PUBSUB { /// Returns the active channels. - public struct CHANNELS: RedisCommand { + public struct CHANNELS: RESPCommand { public typealias Response = [RESPToken] public var pattern: String? = nil @@ -35,39 +34,39 @@ public enum PUBSUB { self.pattern = pattern } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("PUBSUB", "CHANNELS", pattern) } } /// Returns helpful text about the different subcommands. - public struct HELP: RedisCommand { + public struct HELP: RESPCommand { public typealias Response = [RESPToken] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("PUBSUB", "HELP") } } /// Returns a count of unique pattern subscriptions. - public struct NUMPAT: RedisCommand { + public struct NUMPAT: RESPCommand { public typealias Response = Int @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("PUBSUB", "NUMPAT") } } /// Returns a count of subscribers to channels. - public struct NUMSUB: RedisCommand { + public struct NUMSUB: RESPCommand { public typealias Response = [RESPToken] public var channel: [String] = [] @@ -76,13 +75,13 @@ public enum PUBSUB { self.channel = channel } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("PUBSUB", "NUMSUB", channel) } } /// Returns the active shard channels. - public struct SHARDCHANNELS: RedisCommand { + public struct SHARDCHANNELS: RESPCommand { public typealias Response = [RESPToken] public var pattern: String? = nil @@ -91,13 +90,13 @@ public enum PUBSUB { self.pattern = pattern } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("PUBSUB", "SHARDCHANNELS", pattern) } } /// Returns the count of subscribers of shard channels. - public struct SHARDNUMSUB: RedisCommand { + public struct SHARDNUMSUB: RESPCommand { public typealias Response = [RESPToken] public var shardchannel: [String] = [] @@ -106,7 +105,7 @@ public enum PUBSUB { self.shardchannel = shardchannel } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("PUBSUB", "SHARDNUMSUB", shardchannel) } } @@ -114,7 +113,7 @@ public enum PUBSUB { } /// Listens for messages published to channels that match one or more patterns. -public struct PSUBSCRIBE: RedisCommand { +public struct PSUBSCRIBE: RESPCommand { public typealias Response = RESPToken public var pattern: [String] @@ -123,13 +122,13 @@ public struct PSUBSCRIBE: RedisCommand { self.pattern = pattern } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("PSUBSCRIBE", pattern) } } /// Posts a message to a channel. -public struct PUBLISH: RedisCommand { +public struct PUBLISH: RESPCommand { public typealias Response = Int public var channel: String @@ -140,13 +139,13 @@ public struct PUBLISH: RedisCommand { self.message = message } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("PUBLISH", channel, message) } } /// Stops listening to messages published to channels that match one or more patterns. -public struct PUNSUBSCRIBE: RedisCommand { +public struct PUNSUBSCRIBE: RESPCommand { public typealias Response = RESPToken public var pattern: [String] = [] @@ -155,13 +154,13 @@ public struct PUNSUBSCRIBE: RedisCommand { self.pattern = pattern } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("PUNSUBSCRIBE", pattern) } } /// Post a message to a shard channel -public struct SPUBLISH: RedisCommand { +public struct SPUBLISH: RESPCommand { public typealias Response = Int public var shardchannel: String @@ -172,13 +171,13 @@ public struct SPUBLISH: RedisCommand { self.message = message } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("SPUBLISH", shardchannel, message) } } /// Listens for messages published to shard channels. -public struct SSUBSCRIBE: RedisCommand { +public struct SSUBSCRIBE: RESPCommand { public typealias Response = RESPToken public var shardchannel: [String] @@ -187,13 +186,13 @@ public struct SSUBSCRIBE: RedisCommand { self.shardchannel = shardchannel } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("SSUBSCRIBE", shardchannel) } } /// Listens for messages published to channels. -public struct SUBSCRIBE: RedisCommand { +public struct SUBSCRIBE: RESPCommand { public typealias Response = RESPToken public var channel: [String] @@ -202,13 +201,13 @@ public struct SUBSCRIBE: RedisCommand { self.channel = channel } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("SUBSCRIBE", channel) } } /// Stops listening to messages posted to shard channels. -public struct SUNSUBSCRIBE: RedisCommand { +public struct SUNSUBSCRIBE: RESPCommand { public typealias Response = RESPToken public var shardchannel: [String] = [] @@ -217,13 +216,13 @@ public struct SUNSUBSCRIBE: RedisCommand { self.shardchannel = shardchannel } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("SUNSUBSCRIBE", shardchannel) } } /// Stops listening to messages posted to channels. -public struct UNSUBSCRIBE: RedisCommand { +public struct UNSUBSCRIBE: RESPCommand { public typealias Response = RESPToken public var channel: [String] = [] @@ -232,16 +231,16 @@ public struct UNSUBSCRIBE: RedisCommand { self.channel = channel } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("UNSUBSCRIBE", channel) } } -extension RedisConnection { +extension ValkeyConnection { /// Listens for messages published to channels that match one or more patterns. /// - /// - Documentation: [PSUBSCRIBE](https:/redis.io/docs/latest/commands/psubscribe) + /// - Documentation: [PSUBSCRIBE](https:/valkey.io/commands/psubscribe) /// - Version: 2.0.0 /// - Complexity: O(N) where N is the number of patterns to subscribe to. /// - Categories: @pubsub, @slow @@ -253,11 +252,11 @@ extension RedisConnection { /// Posts a message to a channel. /// - /// - Documentation: [PUBLISH](https:/redis.io/docs/latest/commands/publish) + /// - Documentation: [PUBLISH](https:/valkey.io/commands/publish) /// - Version: 2.0.0 /// - Complexity: O(N+M) where N is the number of clients subscribed to the receiving channel and M is the total number of subscribed patterns (by any client). /// - Categories: @pubsub, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of clients that received the message. Note that in a Redis Cluster, only clients that are connected to the same node as the publishing client are included in the count. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of clients that received the message. Note that in a Valkey Cluster, only clients that are connected to the same node as the publishing client are included in the count. @inlinable public func publish(channel: String, message: String) async throws -> Int { try await send(command: PUBLISH(channel: channel, message: message)) @@ -265,11 +264,11 @@ extension RedisConnection { /// Returns the active channels. /// - /// - Documentation: [PUBSUB CHANNELS](https:/redis.io/docs/latest/commands/pubsub-channels) + /// - Documentation: [PUBSUB CHANNELS](https:/valkey.io/commands/pubsub-channels) /// - Version: 2.8.0 /// - Complexity: O(N) where N is the number of active channels, and assuming constant time pattern matching (relatively short channels and patterns) /// - Categories: @pubsub, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of active channels, optionally matching the specified pattern. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of active channels, optionally matching the specified pattern. @inlinable public func pubsubChannels(pattern: String? = nil) async throws -> [RESPToken] { try await send(command: PUBSUB.CHANNELS(pattern: pattern)) @@ -277,11 +276,11 @@ extension RedisConnection { /// Returns helpful text about the different subcommands. /// - /// - Documentation: [PUBSUB HELP](https:/redis.io/docs/latest/commands/pubsub-help) + /// - Documentation: [PUBSUB HELP](https:/valkey.io/commands/pubsub-help) /// - Version: 6.2.0 /// - Complexity: O(1) /// - Categories: @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of sub-commands and their descriptions. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of sub-commands and their descriptions. @inlinable public func pubsubHelp() async throws -> [RESPToken] { try await send(command: PUBSUB.HELP()) @@ -289,11 +288,11 @@ extension RedisConnection { /// Returns a count of unique pattern subscriptions. /// - /// - Documentation: [PUBSUB NUMPAT](https:/redis.io/docs/latest/commands/pubsub-numpat) + /// - Documentation: [PUBSUB NUMPAT](https:/valkey.io/commands/pubsub-numpat) /// - Version: 2.8.0 /// - Complexity: O(1) /// - Categories: @pubsub, @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of patterns all the clients are subscribed to. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of patterns all the clients are subscribed to. @inlinable public func pubsubNumpat() async throws -> Int { try await send(command: PUBSUB.NUMPAT()) @@ -301,11 +300,11 @@ extension RedisConnection { /// Returns a count of subscribers to channels. /// - /// - Documentation: [PUBSUB NUMSUB](https:/redis.io/docs/latest/commands/pubsub-numsub) + /// - Documentation: [PUBSUB NUMSUB](https:/valkey.io/commands/pubsub-numsub) /// - Version: 2.8.0 /// - Complexity: O(N) for the NUMSUB subcommand, where N is the number of requested channels /// - Categories: @pubsub, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): the number of subscribers per channel, each even element (including the 0th) is channel name, each odd element is the number of subscribers + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): the number of subscribers per channel, each even element (including the 0th) is channel name, each odd element is the number of subscribers @inlinable public func pubsubNumsub(channel: [String] = []) async throws -> [RESPToken] { try await send(command: PUBSUB.NUMSUB(channel: channel)) @@ -313,11 +312,11 @@ extension RedisConnection { /// Returns the active shard channels. /// - /// - Documentation: [PUBSUB SHARDCHANNELS](https:/redis.io/docs/latest/commands/pubsub-shardchannels) + /// - Documentation: [PUBSUB SHARDCHANNELS](https:/valkey.io/commands/pubsub-shardchannels) /// - Version: 7.0.0 /// - Complexity: O(N) where N is the number of active shard channels, and assuming constant time pattern matching (relatively short shard channels). /// - Categories: @pubsub, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of active channels, optionally matching the specified pattern. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of active channels, optionally matching the specified pattern. @inlinable public func pubsubShardchannels(pattern: String? = nil) async throws -> [RESPToken] { try await send(command: PUBSUB.SHARDCHANNELS(pattern: pattern)) @@ -325,11 +324,11 @@ extension RedisConnection { /// Returns the count of subscribers of shard channels. /// - /// - Documentation: [PUBSUB SHARDNUMSUB](https:/redis.io/docs/latest/commands/pubsub-shardnumsub) + /// - Documentation: [PUBSUB SHARDNUMSUB](https:/valkey.io/commands/pubsub-shardnumsub) /// - Version: 7.0.0 /// - Complexity: O(N) for the SHARDNUMSUB subcommand, where N is the number of requested shard channels /// - Categories: @pubsub, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): the number of subscribers per shard channel, each even element (including the 0th) is channel name, each odd element is the number of subscribers. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): the number of subscribers per shard channel, each even element (including the 0th) is channel name, each odd element is the number of subscribers. @inlinable public func pubsubShardnumsub(shardchannel: [String] = []) async throws -> [RESPToken] { try await send(command: PUBSUB.SHARDNUMSUB(shardchannel: shardchannel)) @@ -337,7 +336,7 @@ extension RedisConnection { /// Stops listening to messages published to channels that match one or more patterns. /// - /// - Documentation: [PUNSUBSCRIBE](https:/redis.io/docs/latest/commands/punsubscribe) + /// - Documentation: [PUNSUBSCRIBE](https:/valkey.io/commands/punsubscribe) /// - Version: 2.0.0 /// - Complexity: O(N) where N is the number of patterns to unsubscribe. /// - Categories: @pubsub, @slow @@ -349,11 +348,11 @@ extension RedisConnection { /// Post a message to a shard channel /// - /// - Documentation: [SPUBLISH](https:/redis.io/docs/latest/commands/spublish) + /// - Documentation: [SPUBLISH](https:/valkey.io/commands/spublish) /// - Version: 7.0.0 /// - Complexity: O(N) where N is the number of clients subscribed to the receiving shard channel. /// - Categories: @pubsub, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of clients that received the message. Note that in a Redis Cluster, only clients that are connected to the same node as the publishing client are included in the count + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of clients that received the message. Note that in a Valkey Cluster, only clients that are connected to the same node as the publishing client are included in the count @inlinable public func spublish(shardchannel: String, message: String) async throws -> Int { try await send(command: SPUBLISH(shardchannel: shardchannel, message: message)) @@ -361,11 +360,11 @@ extension RedisConnection { /// Listens for messages published to shard channels. /// - /// - Documentation: [SSUBSCRIBE](https:/redis.io/docs/latest/commands/ssubscribe) + /// - Documentation: [SSUBSCRIBE](https:/valkey.io/commands/ssubscribe) /// - Version: 7.0.0 /// - Complexity: O(N) where N is the number of shard channels to subscribe to. /// - Categories: @pubsub, @slow - /// - Returns: When successful, this command doesn't return anything. Instead, for each shard channel, one message with the first element being the string 'ssubscribe' is pushed as a confirmation that the command succeeded. Note that this command can also return a -MOVED redirect. + /// - Returns: When successful, this command doesn't return anything. Instead, for each shard channel, one message with the first element being the string `ssubscribe` is pushed as a confirmation that the command succeeded. Note that this command can also return a -MOVED redirect. @inlinable public func ssubscribe(shardchannel: [String]) async throws -> RESPToken { try await send(command: SSUBSCRIBE(shardchannel: shardchannel)) @@ -373,7 +372,7 @@ extension RedisConnection { /// Listens for messages published to channels. /// - /// - Documentation: [SUBSCRIBE](https:/redis.io/docs/latest/commands/subscribe) + /// - Documentation: [SUBSCRIBE](https:/valkey.io/commands/subscribe) /// - Version: 2.0.0 /// - Complexity: O(N) where N is the number of channels to subscribe to. /// - Categories: @pubsub, @slow @@ -385,7 +384,7 @@ extension RedisConnection { /// Stops listening to messages posted to shard channels. /// - /// - Documentation: [SUNSUBSCRIBE](https:/redis.io/docs/latest/commands/sunsubscribe) + /// - Documentation: [SUNSUBSCRIBE](https:/valkey.io/commands/sunsubscribe) /// - Version: 7.0.0 /// - Complexity: O(N) where N is the number of shard channels to unsubscribe. /// - Categories: @pubsub, @slow @@ -397,7 +396,7 @@ extension RedisConnection { /// Stops listening to messages posted to channels. /// - /// - Documentation: [UNSUBSCRIBE](https:/redis.io/docs/latest/commands/unsubscribe) + /// - Documentation: [UNSUBSCRIBE](https:/valkey.io/commands/unsubscribe) /// - Version: 2.0.0 /// - Complexity: O(N) where N is the number of channels to unsubscribe. /// - Categories: @pubsub, @slow diff --git a/Sources/RedisCommands/ScriptingCommands.swift b/Sources/Valkey/Commands/ScriptingCommands.swift similarity index 69% rename from Sources/RedisCommands/ScriptingCommands.swift rename to Sources/Valkey/Commands/ScriptingCommands.swift index 51824ed2..255f3a14 100644 --- a/Sources/RedisCommands/ScriptingCommands.swift +++ b/Sources/Valkey/Commands/ScriptingCommands.swift @@ -1,21 +1,20 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -// This file is autogenerated by RedisCommandsBuilder +// This file is autogenerated by ValkeyCommandsBuilder import NIOCore -import Redis #if canImport(FoundationEssentials) import FoundationEssentials @@ -26,7 +25,7 @@ import Foundation /// A container for function commands. public enum FUNCTION { /// Deletes a library and its functions. - public struct DELETE: RedisCommand { + public struct DELETE: RESPCommand { public typealias Response = RESPToken public var libraryName: String @@ -35,32 +34,32 @@ public enum FUNCTION { self.libraryName = libraryName } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("FUNCTION", "DELETE", libraryName) } } /// Dumps all libraries into a serialized binary payload. - public struct DUMP: RedisCommand { + public struct DUMP: RESPCommand { public typealias Response = String @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("FUNCTION", "DUMP") } } /// Deletes all libraries and functions. - public struct FLUSH: RedisCommand { + public struct FLUSH: RESPCommand { public enum FlushType: RESPRenderable { case async case sync @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .async: "ASYNC".encode(into: &commandEncoder) case .sync: "SYNC".encode(into: &commandEncoder) @@ -75,39 +74,39 @@ public enum FUNCTION { self.flushType = flushType } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("FUNCTION", "FLUSH", flushType) } } /// Returns helpful text about the different subcommands. - public struct HELP: RedisCommand { + public struct HELP: RESPCommand { public typealias Response = [RESPToken] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("FUNCTION", "HELP") } } /// Terminates a function during execution. - public struct KILL: RedisCommand { + public struct KILL: RESPCommand { public typealias Response = RESPToken @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("FUNCTION", "KILL") } } /// Returns information about all libraries. - public struct LIST: RedisCommand { + public struct LIST: RESPCommand { public typealias Response = [RESPToken] public var libraryNamePattern: String? = nil @@ -118,13 +117,13 @@ public enum FUNCTION { self.withcode = withcode } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("FUNCTION", "LIST", RESPWithToken("LIBRARYNAME", libraryNamePattern), RedisPureToken("WITHCODE", withcode)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("FUNCTION", "LIST", RESPWithToken("LIBRARYNAME", libraryNamePattern), RESPPureToken("WITHCODE", withcode)) } } /// Creates a library. - public struct LOAD: RedisCommand { + public struct LOAD: RESPCommand { public typealias Response = String public var replace: Bool = false @@ -135,20 +134,20 @@ public enum FUNCTION { self.functionCode = functionCode } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("FUNCTION", "LOAD", RedisPureToken("REPLACE", replace), functionCode) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("FUNCTION", "LOAD", RESPPureToken("REPLACE", replace), functionCode) } } /// Restores all libraries from a payload. - public struct RESTORE: RedisCommand { + public struct RESTORE: RESPCommand { public enum Policy: RESPRenderable { case flush case append case replace @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .flush: "FLUSH".encode(into: &commandEncoder) case .append: "APPEND".encode(into: &commandEncoder) @@ -166,20 +165,20 @@ public enum FUNCTION { self.policy = policy } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("FUNCTION", "RESTORE", serializedValue, policy) } } /// Returns information about a function during execution. - public struct STATS: RedisCommand { + public struct STATS: RESPCommand { public typealias Response = [String: RESPToken] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("FUNCTION", "STATS") } } @@ -189,14 +188,14 @@ public enum FUNCTION { /// A container for Lua scripts management commands. public enum SCRIPT { /// Sets the debug mode of server-side Lua scripts. - public struct DEBUG: RedisCommand { + public struct DEBUG: RESPCommand { public enum Mode: RESPRenderable { case yes case sync case no @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .yes: "YES".encode(into: &commandEncoder) case .sync: "SYNC".encode(into: &commandEncoder) @@ -212,13 +211,13 @@ public enum SCRIPT { self.mode = mode } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("SCRIPT", "DEBUG", mode) } } /// Determines whether server-side Lua scripts exist in the script cache. - public struct EXISTS: RedisCommand { + public struct EXISTS: RESPCommand { public typealias Response = [RESPToken] public var sha1: [String] @@ -227,19 +226,19 @@ public enum SCRIPT { self.sha1 = sha1 } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("SCRIPT", "EXISTS", sha1) } } /// Removes all server-side Lua scripts from the script cache. - public struct FLUSH: RedisCommand { + public struct FLUSH: RESPCommand { public enum FlushType: RESPRenderable { case async case sync @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .async: "ASYNC".encode(into: &commandEncoder) case .sync: "SYNC".encode(into: &commandEncoder) @@ -254,39 +253,39 @@ public enum SCRIPT { self.flushType = flushType } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("SCRIPT", "FLUSH", flushType) } } /// Returns helpful text about the different subcommands. - public struct HELP: RedisCommand { + public struct HELP: RESPCommand { public typealias Response = [RESPToken] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("SCRIPT", "HELP") } } /// Terminates a server-side Lua script during execution. - public struct KILL: RedisCommand { + public struct KILL: RESPCommand { public typealias Response = RESPToken @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("SCRIPT", "KILL") } } /// Loads a server-side Lua script to the script cache. - public struct LOAD: RedisCommand { + public struct LOAD: RESPCommand { public typealias Response = String public var script: String @@ -295,7 +294,7 @@ public enum SCRIPT { self.script = script } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("SCRIPT", "LOAD", script) } } @@ -303,200 +302,200 @@ public enum SCRIPT { } /// Executes a server-side Lua script. -public struct EVAL: RedisCommand { +public struct EVAL: RESPCommand { public typealias Response = RESPToken public var script: String - public var key: [RedisKey] = [] + public var key: [RESPKey] = [] public var arg: [String] = [] - @inlinable public init(script: String, key: [RedisKey] = [], arg: [String] = []) { + @inlinable public init(script: String, key: [RESPKey] = [], arg: [String] = []) { self.script = script self.key = key self.arg = arg } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("EVAL", script, RESPArrayWithCount(key), arg) } } /// Executes a server-side Lua script by SHA1 digest. -public struct EVALSHA: RedisCommand { +public struct EVALSHA: RESPCommand { public typealias Response = RESPToken public var sha1: String - public var key: [RedisKey] = [] + public var key: [RESPKey] = [] public var arg: [String] = [] - @inlinable public init(sha1: String, key: [RedisKey] = [], arg: [String] = []) { + @inlinable public init(sha1: String, key: [RESPKey] = [], arg: [String] = []) { self.sha1 = sha1 self.key = key self.arg = arg } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("EVALSHA", sha1, RESPArrayWithCount(key), arg) } } /// Executes a read-only server-side Lua script by SHA1 digest. -public struct EVALSHARO: RedisCommand { +public struct EVALSHARO: RESPCommand { public typealias Response = RESPToken public var sha1: String - public var key: [RedisKey] = [] + public var key: [RESPKey] = [] public var arg: [String] = [] - @inlinable public init(sha1: String, key: [RedisKey] = [], arg: [String] = []) { + @inlinable public init(sha1: String, key: [RESPKey] = [], arg: [String] = []) { self.sha1 = sha1 self.key = key self.arg = arg } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("EVALSHA_RO", sha1, RESPArrayWithCount(key), arg) } } /// Executes a read-only server-side Lua script. -public struct EVALRO: RedisCommand { +public struct EVALRO: RESPCommand { public typealias Response = RESPToken public var script: String - public var key: [RedisKey] = [] + public var key: [RESPKey] = [] public var arg: [String] = [] - @inlinable public init(script: String, key: [RedisKey] = [], arg: [String] = []) { + @inlinable public init(script: String, key: [RESPKey] = [], arg: [String] = []) { self.script = script self.key = key self.arg = arg } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("EVAL_RO", script, RESPArrayWithCount(key), arg) } } /// Invokes a function. -public struct FCALL: RedisCommand { +public struct FCALL: RESPCommand { public typealias Response = RESPToken public var function: String - public var key: [RedisKey] = [] + public var key: [RESPKey] = [] public var arg: [String] = [] - @inlinable public init(function: String, key: [RedisKey] = [], arg: [String] = []) { + @inlinable public init(function: String, key: [RESPKey] = [], arg: [String] = []) { self.function = function self.key = key self.arg = arg } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("FCALL", function, RESPArrayWithCount(key), arg) } } /// Invokes a read-only function. -public struct FCALLRO: RedisCommand { +public struct FCALLRO: RESPCommand { public typealias Response = RESPToken public var function: String - public var key: [RedisKey] = [] + public var key: [RESPKey] = [] public var arg: [String] = [] - @inlinable public init(function: String, key: [RedisKey] = [], arg: [String] = []) { + @inlinable public init(function: String, key: [RESPKey] = [], arg: [String] = []) { self.function = function self.key = key self.arg = arg } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("FCALL_RO", function, RESPArrayWithCount(key), arg) } } -extension RedisConnection { +extension ValkeyConnection { /// Executes a server-side Lua script. /// - /// - Documentation: [EVAL](https:/redis.io/docs/latest/commands/eval) + /// - Documentation: [EVAL](https:/valkey.io/commands/eval) /// - Version: 2.6.0 /// - Complexity: Depends on the script that is executed. /// - Categories: @slow, @scripting /// - Returns: The return value depends on the script that was executed. @inlinable - public func eval(script: String, key: [RedisKey] = [], arg: [String] = []) async throws -> RESPToken { + public func eval(script: String, key: [RESPKey] = [], arg: [String] = []) async throws -> RESPToken { try await send(command: EVAL(script: script, key: key, arg: arg)) } /// Executes a server-side Lua script by SHA1 digest. /// - /// - Documentation: [EVALSHA](https:/redis.io/docs/latest/commands/evalsha) + /// - Documentation: [EVALSHA](https:/valkey.io/commands/evalsha) /// - Version: 2.6.0 /// - Complexity: Depends on the script that is executed. /// - Categories: @slow, @scripting /// - Returns: The return value depends on the script that was executed. @inlinable - public func evalsha(sha1: String, key: [RedisKey] = [], arg: [String] = []) async throws -> RESPToken { + public func evalsha(sha1: String, key: [RESPKey] = [], arg: [String] = []) async throws -> RESPToken { try await send(command: EVALSHA(sha1: sha1, key: key, arg: arg)) } /// Executes a read-only server-side Lua script by SHA1 digest. /// - /// - Documentation: [EVALSHA_RO](https:/redis.io/docs/latest/commands/evalsha_ro) + /// - Documentation: [EVALSHA_RO](https:/valkey.io/commands/evalsha_ro) /// - Version: 7.0.0 /// - Complexity: Depends on the script that is executed. /// - Categories: @slow, @scripting /// - Returns: The return value depends on the script that was executed. @inlinable - public func evalshaRo(sha1: String, key: [RedisKey] = [], arg: [String] = []) async throws -> RESPToken { + public func evalshaRo(sha1: String, key: [RESPKey] = [], arg: [String] = []) async throws -> RESPToken { try await send(command: EVALSHARO(sha1: sha1, key: key, arg: arg)) } /// Executes a read-only server-side Lua script. /// - /// - Documentation: [EVAL_RO](https:/redis.io/docs/latest/commands/eval_ro) + /// - Documentation: [EVAL_RO](https:/valkey.io/commands/eval_ro) /// - Version: 7.0.0 /// - Complexity: Depends on the script that is executed. /// - Categories: @slow, @scripting /// - Returns: The return value depends on the script that was executed. @inlinable - public func evalRo(script: String, key: [RedisKey] = [], arg: [String] = []) async throws -> RESPToken { + public func evalRo(script: String, key: [RESPKey] = [], arg: [String] = []) async throws -> RESPToken { try await send(command: EVALRO(script: script, key: key, arg: arg)) } /// Invokes a function. /// - /// - Documentation: [FCALL](https:/redis.io/docs/latest/commands/fcall) + /// - Documentation: [FCALL](https:/valkey.io/commands/fcall) /// - Version: 7.0.0 /// - Complexity: Depends on the function that is executed. /// - Categories: @slow, @scripting /// - Returns: The return value depends on the function that was executed. @inlinable - public func fcall(function: String, key: [RedisKey] = [], arg: [String] = []) async throws -> RESPToken { + public func fcall(function: String, key: [RESPKey] = [], arg: [String] = []) async throws -> RESPToken { try await send(command: FCALL(function: function, key: key, arg: arg)) } /// Invokes a read-only function. /// - /// - Documentation: [FCALL_RO](https:/redis.io/docs/latest/commands/fcall_ro) + /// - Documentation: [FCALL_RO](https:/valkey.io/commands/fcall_ro) /// - Version: 7.0.0 /// - Complexity: Depends on the function that is executed. /// - Categories: @slow, @scripting /// - Returns: The return value depends on the function that was executed. @inlinable - public func fcallRo(function: String, key: [RedisKey] = [], arg: [String] = []) async throws -> RESPToken { + public func fcallRo(function: String, key: [RESPKey] = [], arg: [String] = []) async throws -> RESPToken { try await send(command: FCALLRO(function: function, key: key, arg: arg)) } /// Deletes a library and its functions. /// - /// - Documentation: [FUNCTION DELETE](https:/redis.io/docs/latest/commands/function-delete) + /// - Documentation: [FUNCTION DELETE](https:/valkey.io/commands/function-delete) /// - Version: 7.0.0 /// - Complexity: O(1) /// - Categories: @write, @slow, @scripting - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func functionDelete(libraryName: String) async throws -> RESPToken { try await send(command: FUNCTION.DELETE(libraryName: libraryName)) @@ -504,11 +503,11 @@ extension RedisConnection { /// Dumps all libraries into a serialized binary payload. /// - /// - Documentation: [FUNCTION DUMP](https:/redis.io/docs/latest/commands/function-dump) + /// - Documentation: [FUNCTION DUMP](https:/valkey.io/commands/function-dump) /// - Version: 7.0.0 /// - Complexity: O(N) where N is the number of functions /// - Categories: @slow, @scripting - /// - Returns: [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): the serialized payload + /// - Returns: [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): the serialized payload @inlinable public func functionDump() async throws -> String { try await send(command: FUNCTION.DUMP()) @@ -516,11 +515,11 @@ extension RedisConnection { /// Deletes all libraries and functions. /// - /// - Documentation: [FUNCTION FLUSH](https:/redis.io/docs/latest/commands/function-flush) + /// - Documentation: [FUNCTION FLUSH](https:/valkey.io/commands/function-flush) /// - Version: 7.0.0 /// - Complexity: O(N) where N is the number of functions deleted /// - Categories: @write, @slow, @scripting - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func functionFlush(flushType: FUNCTION.FLUSH.FlushType? = nil) async throws -> RESPToken { try await send(command: FUNCTION.FLUSH(flushType: flushType)) @@ -528,11 +527,11 @@ extension RedisConnection { /// Returns helpful text about the different subcommands. /// - /// - Documentation: [FUNCTION HELP](https:/redis.io/docs/latest/commands/function-help) + /// - Documentation: [FUNCTION HELP](https:/valkey.io/commands/function-help) /// - Version: 7.0.0 /// - Complexity: O(1) /// - Categories: @slow, @scripting - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of sub-commands and their descriptions. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of sub-commands and their descriptions. @inlinable public func functionHelp() async throws -> [RESPToken] { try await send(command: FUNCTION.HELP()) @@ -540,11 +539,11 @@ extension RedisConnection { /// Terminates a function during execution. /// - /// - Documentation: [FUNCTION KILL](https:/redis.io/docs/latest/commands/function-kill) + /// - Documentation: [FUNCTION KILL](https:/valkey.io/commands/function-kill) /// - Version: 7.0.0 /// - Complexity: O(1) /// - Categories: @slow, @scripting - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func functionKill() async throws -> RESPToken { try await send(command: FUNCTION.KILL()) @@ -552,11 +551,11 @@ extension RedisConnection { /// Returns information about all libraries. /// - /// - Documentation: [FUNCTION LIST](https:/redis.io/docs/latest/commands/function-list) + /// - Documentation: [FUNCTION LIST](https:/valkey.io/commands/function-list) /// - Version: 7.0.0 /// - Complexity: O(N) where N is the number of functions /// - Categories: @slow, @scripting - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): information about functions and libraries. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): information about functions and libraries. @inlinable public func functionList(libraryNamePattern: String? = nil, withcode: Bool = false) async throws -> [RESPToken] { try await send(command: FUNCTION.LIST(libraryNamePattern: libraryNamePattern, withcode: withcode)) @@ -564,11 +563,11 @@ extension RedisConnection { /// Creates a library. /// - /// - Documentation: [FUNCTION LOAD](https:/redis.io/docs/latest/commands/function-load) + /// - Documentation: [FUNCTION LOAD](https:/valkey.io/commands/function-load) /// - Version: 7.0.0 /// - Complexity: O(1) (considering compilation time is redundant) /// - Categories: @write, @slow, @scripting - /// - Returns: [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): the library name that was loaded. + /// - Returns: [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): the library name that was loaded. @inlinable public func functionLoad(replace: Bool = false, functionCode: String) async throws -> String { try await send(command: FUNCTION.LOAD(replace: replace, functionCode: functionCode)) @@ -576,11 +575,11 @@ extension RedisConnection { /// Restores all libraries from a payload. /// - /// - Documentation: [FUNCTION RESTORE](https:/redis.io/docs/latest/commands/function-restore) + /// - Documentation: [FUNCTION RESTORE](https:/valkey.io/commands/function-restore) /// - Version: 7.0.0 /// - Complexity: O(N) where N is the number of functions on the payload /// - Categories: @write, @slow, @scripting - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func functionRestore(serializedValue: String, policy: FUNCTION.RESTORE.Policy? = nil) async throws -> RESPToken { try await send(command: FUNCTION.RESTORE(serializedValue: serializedValue, policy: policy)) @@ -588,11 +587,11 @@ extension RedisConnection { /// Returns information about a function during execution. /// - /// - Documentation: [FUNCTION STATS](https:/redis.io/docs/latest/commands/function-stats) + /// - Documentation: [FUNCTION STATS](https:/valkey.io/commands/function-stats) /// - Version: 7.0.0 /// - Complexity: O(1) /// - Categories: @slow, @scripting - /// - Returns: [Map](https:/redis.io/docs/reference/protocol-spec#maps): information about the function that's currently running and information about the available execution engines. + /// - Returns: [Map](https:/valkey.io/topics/protocol/#maps): information about the function that's currently running and information about the available execution engines. @inlinable public func functionStats() async throws -> [String: RESPToken] { try await send(command: FUNCTION.STATS()) @@ -600,11 +599,11 @@ extension RedisConnection { /// Sets the debug mode of server-side Lua scripts. /// - /// - Documentation: [SCRIPT DEBUG](https:/redis.io/docs/latest/commands/script-debug) + /// - Documentation: [SCRIPT DEBUG](https:/valkey.io/commands/script-debug) /// - Version: 3.2.0 /// - Complexity: O(1) /// - Categories: @slow, @scripting - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func scriptDebug(mode: SCRIPT.DEBUG.Mode) async throws -> RESPToken { try await send(command: SCRIPT.DEBUG(mode: mode)) @@ -612,11 +611,11 @@ extension RedisConnection { /// Determines whether server-side Lua scripts exist in the script cache. /// - /// - Documentation: [SCRIPT EXISTS](https:/redis.io/docs/latest/commands/script-exists) + /// - Documentation: [SCRIPT EXISTS](https:/valkey.io/commands/script-exists) /// - Version: 2.6.0 /// - Complexity: O(N) with N being the number of scripts to check (so checking a single script is an O(1) operation). /// - Categories: @slow, @scripting - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): an array of integers that correspond to the specified SHA1 digest arguments. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): an array of integers that correspond to the specified SHA1 digest arguments. @inlinable public func scriptExists(sha1: [String]) async throws -> [RESPToken] { try await send(command: SCRIPT.EXISTS(sha1: sha1)) @@ -624,11 +623,11 @@ extension RedisConnection { /// Removes all server-side Lua scripts from the script cache. /// - /// - Documentation: [SCRIPT FLUSH](https:/redis.io/docs/latest/commands/script-flush) + /// - Documentation: [SCRIPT FLUSH](https:/valkey.io/commands/script-flush) /// - Version: 2.6.0 /// - Complexity: O(N) with N being the number of scripts in cache /// - Categories: @slow, @scripting - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func scriptFlush(flushType: SCRIPT.FLUSH.FlushType? = nil) async throws -> RESPToken { try await send(command: SCRIPT.FLUSH(flushType: flushType)) @@ -636,11 +635,11 @@ extension RedisConnection { /// Returns helpful text about the different subcommands. /// - /// - Documentation: [SCRIPT HELP](https:/redis.io/docs/latest/commands/script-help) + /// - Documentation: [SCRIPT HELP](https:/valkey.io/commands/script-help) /// - Version: 5.0.0 /// - Complexity: O(1) /// - Categories: @slow, @scripting - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of sub-commands and their descriptions. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of sub-commands and their descriptions. @inlinable public func scriptHelp() async throws -> [RESPToken] { try await send(command: SCRIPT.HELP()) @@ -648,11 +647,11 @@ extension RedisConnection { /// Terminates a server-side Lua script during execution. /// - /// - Documentation: [SCRIPT KILL](https:/redis.io/docs/latest/commands/script-kill) + /// - Documentation: [SCRIPT KILL](https:/valkey.io/commands/script-kill) /// - Version: 2.6.0 /// - Complexity: O(1) /// - Categories: @slow, @scripting - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func scriptKill() async throws -> RESPToken { try await send(command: SCRIPT.KILL()) @@ -660,11 +659,11 @@ extension RedisConnection { /// Loads a server-side Lua script to the script cache. /// - /// - Documentation: [SCRIPT LOAD](https:/redis.io/docs/latest/commands/script-load) + /// - Documentation: [SCRIPT LOAD](https:/valkey.io/commands/script-load) /// - Version: 2.6.0 /// - Complexity: O(N) with N being the length in bytes of the script body. /// - Categories: @slow, @scripting - /// - Returns: [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): the SHA1 digest of the script added into the script cache. + /// - Returns: [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): the SHA1 digest of the script added into the script cache. @inlinable public func scriptLoad(script: String) async throws -> String { try await send(command: SCRIPT.LOAD(script: script)) diff --git a/Sources/RedisCommands/ServerCommands.swift b/Sources/Valkey/Commands/ServerCommands.swift similarity index 67% rename from Sources/RedisCommands/ServerCommands.swift rename to Sources/Valkey/Commands/ServerCommands.swift index d4a51844..d21e7a99 100644 --- a/Sources/RedisCommands/ServerCommands.swift +++ b/Sources/Valkey/Commands/ServerCommands.swift @@ -1,21 +1,20 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -// This file is autogenerated by RedisCommandsBuilder +// This file is autogenerated by ValkeyCommandsBuilder import NIOCore -import Redis #if canImport(FoundationEssentials) import FoundationEssentials @@ -26,7 +25,7 @@ import Foundation /// A container for Access List Control commands. public enum ACL { /// Lists the ACL categories, or the commands inside a category. - public struct CAT: RedisCommand { + public struct CAT: RESPCommand { public typealias Response = [String] public var category: String? = nil @@ -35,13 +34,13 @@ public enum ACL { self.category = category } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ACL", "CAT", category) } } /// Deletes ACL users, and terminates their connections. - public struct DELUSER: RedisCommand { + public struct DELUSER: RESPCommand { public typealias Response = Int public var username: [String] @@ -50,13 +49,13 @@ public enum ACL { self.username = username } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ACL", "DELUSER", username) } } /// Simulates the execution of a command by a user, without executing the command. - public struct DRYRUN: RedisCommand { + public struct DRYRUN: RESPCommand { public typealias Response = String? public var username: String @@ -69,13 +68,13 @@ public enum ACL { self.arg = arg } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ACL", "DRYRUN", username, command, arg) } } /// Generates a pseudorandom, secure password that can be used to identify ACL users. - public struct GENPASS: RedisCommand { + public struct GENPASS: RESPCommand { public typealias Response = String public var bits: Int? = nil @@ -84,13 +83,13 @@ public enum ACL { self.bits = bits } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ACL", "GENPASS", bits) } } /// Lists the ACL rules of a user. - public struct GETUSER: RedisCommand { + public struct GETUSER: RESPCommand { public typealias Response = [String: RESPToken]? public var username: String @@ -99,58 +98,58 @@ public enum ACL { self.username = username } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ACL", "GETUSER", username) } } /// Returns helpful text about the different subcommands. - public struct HELP: RedisCommand { + public struct HELP: RESPCommand { public typealias Response = [RESPToken] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ACL", "HELP") } } /// Dumps the effective rules in ACL file format. - public struct LIST: RedisCommand { + public struct LIST: RESPCommand { public typealias Response = [String] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ACL", "LIST") } } /// Reloads the rules from the configured ACL file. - public struct LOAD: RedisCommand { + public struct LOAD: RESPCommand { public typealias Response = RESPToken @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ACL", "LOAD") } } /// Lists recent security events generated due to ACL rules. - public struct LOG: RedisCommand { + public struct LOG: RESPCommand { public enum Operation: RESPRenderable { case count(Int) case reset @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .count(let count): count.encode(into: &commandEncoder) case .reset: "RESET".encode(into: &commandEncoder) @@ -165,26 +164,26 @@ public enum ACL { self.operation = operation } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ACL", "LOG", operation) } } /// Saves the effective ACL rules in the configured ACL file. - public struct SAVE: RedisCommand { + public struct SAVE: RESPCommand { public typealias Response = RESPToken @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ACL", "SAVE") } } /// Creates and modifies an ACL user and its rules. - public struct SETUSER: RedisCommand { + public struct SETUSER: RESPCommand { public typealias Response = RESPToken public var username: String @@ -195,33 +194,33 @@ public enum ACL { self.rule = rule } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ACL", "SETUSER", username, rule) } } /// Lists all ACL users. - public struct USERS: RedisCommand { + public struct USERS: RESPCommand { public typealias Response = [RESPToken] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ACL", "USERS") } } /// Returns the authenticated username of the current connection. - public struct WHOAMI: RedisCommand { + public struct WHOAMI: RESPCommand { public typealias Response = String @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ACL", "WHOAMI") } } @@ -230,20 +229,20 @@ public enum ACL { extension COMMAND { /// Returns a count of commands. - public struct COUNT: RedisCommand { + public struct COUNT: RESPCommand { public typealias Response = Int @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("COMMAND", "COUNT") } } /// Returns documentary information about one, multiple or all commands. - public struct DOCS: RedisCommand { + public struct DOCS: RESPCommand { public typealias Response = [String: RESPToken] public var commandName: [String] = [] @@ -252,13 +251,13 @@ extension COMMAND { self.commandName = commandName } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("COMMAND", "DOCS", commandName) } } /// Extracts the key names from an arbitrary command. - public struct GETKEYS: RedisCommand { + public struct GETKEYS: RESPCommand { public typealias Response = [RESPToken] public var command: String @@ -269,13 +268,13 @@ extension COMMAND { self.arg = arg } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("COMMAND", "GETKEYS", command, arg) } } /// Extracts the key names and access flags for an arbitrary command. - public struct GETKEYSANDFLAGS: RedisCommand { + public struct GETKEYSANDFLAGS: RESPCommand { public typealias Response = [RESPToken] public var command: String @@ -286,26 +285,26 @@ extension COMMAND { self.arg = arg } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("COMMAND", "GETKEYSANDFLAGS", command, arg) } } /// Returns helpful text about the different subcommands. - public struct HELP: RedisCommand { + public struct HELP: RESPCommand { public typealias Response = [RESPToken] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("COMMAND", "HELP") } } /// Returns information about one, multiple or all commands. - public struct INFO: RedisCommand { + public struct INFO: RESPCommand { public typealias Response = [RESPToken] public var commandName: [String] = [] @@ -314,20 +313,20 @@ extension COMMAND { self.commandName = commandName } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("COMMAND", "INFO", commandName) } } /// Returns a list of command names. - public struct LIST: RedisCommand { + public struct LIST: RESPCommand { public enum Filterby: RESPRenderable { case moduleName(String) case category(String) case pattern(String) @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .moduleName(let moduleName): RESPWithToken("MODULE", moduleName).encode(into: &commandEncoder) case .category(let category): RESPWithToken("ACLCAT", category).encode(into: &commandEncoder) @@ -343,7 +342,7 @@ extension COMMAND { self.filterby = filterby } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("COMMAND", "LIST", RESPWithToken("FILTERBY", filterby)) } } @@ -353,7 +352,7 @@ extension COMMAND { /// A container for server configuration commands. public enum CONFIG { /// Returns the effective values of configuration parameters. - public struct GET: RedisCommand { + public struct GET: RESPCommand { public typealias Response = [String: RESPToken] public var parameter: [String] @@ -362,58 +361,58 @@ public enum CONFIG { self.parameter = parameter } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CONFIG", "GET", parameter) } } /// Returns helpful text about the different subcommands. - public struct HELP: RedisCommand { + public struct HELP: RESPCommand { public typealias Response = [RESPToken] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CONFIG", "HELP") } } /// Resets the server's statistics. - public struct RESETSTAT: RedisCommand { + public struct RESETSTAT: RESPCommand { public typealias Response = RESPToken @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CONFIG", "RESETSTAT") } } /// Persists the effective configuration to file. - public struct REWRITE: RedisCommand { + public struct REWRITE: RESPCommand { public typealias Response = RESPToken @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CONFIG", "REWRITE") } } /// Sets configuration parameters in-flight. - public struct SET: RedisCommand { + public struct SET: RESPCommand { public struct Data: RESPRenderable { @usableFromInline let parameter: String @usableFromInline let value: String @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += parameter.encode(into: &commandEncoder) count += value.encode(into: &commandEncoder) @@ -428,7 +427,7 @@ public enum CONFIG { self.data = data } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("CONFIG", "SET", data) } } @@ -438,20 +437,20 @@ public enum CONFIG { /// A container for latency diagnostics commands. public enum LATENCY { /// Returns a human-readable latency analysis report. - public struct DOCTOR: RedisCommand { + public struct DOCTOR: RESPCommand { public typealias Response = String @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("LATENCY", "DOCTOR") } } /// Returns a latency graph for an event. - public struct GRAPH: RedisCommand { + public struct GRAPH: RESPCommand { public typealias Response = String public var event: String @@ -460,26 +459,26 @@ public enum LATENCY { self.event = event } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("LATENCY", "GRAPH", event) } } /// Returns helpful text about the different subcommands. - public struct HELP: RedisCommand { + public struct HELP: RESPCommand { public typealias Response = [RESPToken] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("LATENCY", "HELP") } } /// Returns the cumulative distribution of latencies of a subset or all commands. - public struct HISTOGRAM: RedisCommand { + public struct HISTOGRAM: RESPCommand { public typealias Response = [String: RESPToken] public var command: [String] = [] @@ -488,13 +487,13 @@ public enum LATENCY { self.command = command } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("LATENCY", "HISTOGRAM", command) } } /// Returns timestamp-latency samples for an event. - public struct HISTORY: RedisCommand { + public struct HISTORY: RESPCommand { public typealias Response = [RESPToken] public var event: String @@ -503,26 +502,26 @@ public enum LATENCY { self.event = event } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("LATENCY", "HISTORY", event) } } /// Returns the latest latency samples for all events. - public struct LATEST: RedisCommand { + public struct LATEST: RESPCommand { public typealias Response = [RESPToken] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("LATENCY", "LATEST") } } /// Resets the latency data for one or more events. - public struct RESET: RedisCommand { + public struct RESET: RESPCommand { public typealias Response = Int public var event: [String] = [] @@ -531,7 +530,7 @@ public enum LATENCY { self.event = event } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("LATENCY", "RESET", event) } } @@ -541,83 +540,83 @@ public enum LATENCY { /// A container for memory diagnostics commands. public enum MEMORY { /// Outputs a memory problems report. - public struct DOCTOR: RedisCommand { + public struct DOCTOR: RESPCommand { public typealias Response = String @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("MEMORY", "DOCTOR") } } /// Returns helpful text about the different subcommands. - public struct HELP: RedisCommand { + public struct HELP: RESPCommand { public typealias Response = [RESPToken] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("MEMORY", "HELP") } } /// Returns the allocator statistics. - public struct MALLOCSTATS: RedisCommand { + public struct MALLOCSTATS: RESPCommand { public typealias Response = String @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("MEMORY", "MALLOC-STATS") } } /// Asks the allocator to release memory. - public struct PURGE: RedisCommand { + public struct PURGE: RESPCommand { public typealias Response = RESPToken @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("MEMORY", "PURGE") } } /// Returns details about memory usage. - public struct STATS: RedisCommand { + public struct STATS: RESPCommand { public typealias Response = [String: RESPToken] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("MEMORY", "STATS") } } /// Estimates the memory usage of a key. - public struct USAGE: RedisCommand { + public struct USAGE: RESPCommand { public typealias Response = Int? - public var key: RedisKey + public var key: RESPKey public var count: Int? = nil - @inlinable public init(key: RedisKey, count: Int? = nil) { + @inlinable public init(key: RESPKey, count: Int? = nil) { self.key = key self.count = count } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("MEMORY", "USAGE", key, RESPWithToken("SAMPLES", count)) } } @@ -627,33 +626,33 @@ public enum MEMORY { /// A container for module commands. public enum MODULE { /// Returns helpful text about the different subcommands. - public struct HELP: RedisCommand { + public struct HELP: RESPCommand { public typealias Response = [RESPToken] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("MODULE", "HELP") } } /// Returns all loaded modules. - public struct LIST: RedisCommand { + public struct LIST: RESPCommand { public typealias Response = [RESPToken] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("MODULE", "LIST") } } /// Loads a module. - public struct LOAD: RedisCommand { + public struct LOAD: RESPCommand { public typealias Response = RESPToken public var path: String @@ -664,19 +663,19 @@ public enum MODULE { self.arg = arg } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("MODULE", "LOAD", path, arg) } } /// Loads a module using extended parameters. - public struct LOADEX: RedisCommand { + public struct LOADEX: RESPCommand { public struct Configs: RESPRenderable { @usableFromInline let name: String @usableFromInline let value: String @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += name.encode(into: &commandEncoder) count += value.encode(into: &commandEncoder) @@ -695,13 +694,13 @@ public enum MODULE { self.args = args } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("MODULE", "LOADEX", path, RESPWithToken("CONFIG", configs), RESPWithToken("ARGS", args)) } } /// Unloads a module. - public struct UNLOAD: RedisCommand { + public struct UNLOAD: RESPCommand { public typealias Response = RESPToken public var name: String @@ -710,7 +709,7 @@ public enum MODULE { self.name = name } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("MODULE", "UNLOAD", name) } } @@ -720,7 +719,7 @@ public enum MODULE { /// A container for slow log commands. public enum SLOWLOG { /// Returns the slow log's entries. - public struct GET: RedisCommand { + public struct GET: RESPCommand { public typealias Response = [RESPToken] public var count: Int? = nil @@ -729,46 +728,46 @@ public enum SLOWLOG { self.count = count } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("SLOWLOG", "GET", count) } } /// Show helpful text about the different subcommands - public struct HELP: RedisCommand { + public struct HELP: RESPCommand { public typealias Response = [RESPToken] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("SLOWLOG", "HELP") } } /// Returns the number of entries in the slow log. - public struct LEN: RedisCommand { + public struct LEN: RESPCommand { public typealias Response = Int @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("SLOWLOG", "LEN") } } /// Clears all entries from the slow log. - public struct RESET: RedisCommand { + public struct RESET: RESPCommand { public typealias Response = RESPToken @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("SLOWLOG", "RESET") } } @@ -776,20 +775,20 @@ public enum SLOWLOG { } /// Asynchronously rewrites the append-only file to disk. -public struct BGREWRITEAOF: RedisCommand { +public struct BGREWRITEAOF: RESPCommand { public typealias Response = String @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("BGREWRITEAOF") } } /// Asynchronously saves the database(s) to disk. -public struct BGSAVE: RedisCommand { +public struct BGSAVE: RESPCommand { public typealias Response = String public var schedule: Bool = false @@ -798,46 +797,46 @@ public struct BGSAVE: RedisCommand { self.schedule = schedule } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("BGSAVE", RedisPureToken("SCHEDULE", schedule)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("BGSAVE", RESPPureToken("SCHEDULE", schedule)) } } /// Returns detailed information about all commands. -public struct COMMAND: RedisCommand { +public struct COMMAND: RESPCommand { public typealias Response = [RESPToken] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("COMMAND") } } /// Returns the number of keys in the database. -public struct DBSIZE: RedisCommand { +public struct DBSIZE: RESPCommand { public typealias Response = Int @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("DBSIZE") } } /// Starts a coordinated failover from a server to one of its replicas. -public struct FAILOVER: RedisCommand { +public struct FAILOVER: RESPCommand { public struct Target: RESPRenderable { @usableFromInline let host: String @usableFromInline let port: Int @usableFromInline let force: Bool @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += host.encode(into: &commandEncoder) count += port.encode(into: &commandEncoder) @@ -857,19 +856,19 @@ public struct FAILOVER: RedisCommand { self.milliseconds = milliseconds } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("FAILOVER", RESPWithToken("TO", target), RedisPureToken("ABORT", abort), RESPWithToken("TIMEOUT", milliseconds)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("FAILOVER", RESPWithToken("TO", target), RESPPureToken("ABORT", abort), RESPWithToken("TIMEOUT", milliseconds)) } } /// Removes all keys from all databases. -public struct FLUSHALL: RedisCommand { +public struct FLUSHALL: RESPCommand { public enum FlushType: RESPRenderable { case async case sync @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .async: "ASYNC".encode(into: &commandEncoder) case .sync: "SYNC".encode(into: &commandEncoder) @@ -884,19 +883,19 @@ public struct FLUSHALL: RedisCommand { self.flushType = flushType } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("FLUSHALL", flushType) } } /// Remove all keys from the current database. -public struct FLUSHDB: RedisCommand { +public struct FLUSHDB: RESPCommand { public enum FlushType: RESPRenderable { case async case sync @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .async: "ASYNC".encode(into: &commandEncoder) case .sync: "SYNC".encode(into: &commandEncoder) @@ -911,13 +910,13 @@ public struct FLUSHDB: RedisCommand { self.flushType = flushType } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("FLUSHDB", flushType) } } /// Returns information and statistics about the server. -public struct INFO: RedisCommand { +public struct INFO: RESPCommand { public typealias Response = String public var section: [String] = [] @@ -926,26 +925,26 @@ public struct INFO: RedisCommand { self.section = section } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("INFO", section) } } /// Returns the Unix timestamp of the last successful save to disk. -public struct LASTSAVE: RedisCommand { +public struct LASTSAVE: RESPCommand { public typealias Response = Int @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("LASTSAVE") } } -/// Displays computer art and the Redis version -public struct LOLWUT: RedisCommand { +/// Displays computer art and the Valkey version +public struct LOLWUT: RESPCommand { public typealias Response = String public var version: Int? = nil @@ -954,26 +953,26 @@ public struct LOLWUT: RedisCommand { self.version = version } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("LOLWUT", RESPWithToken("VERSION", version)) } } /// Listens for all requests received by the server in real-time. -public struct MONITOR: RedisCommand { +public struct MONITOR: RESPCommand { public typealias Response = RESPToken @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("MONITOR") } } /// An internal command used in replication. -public struct PSYNC: RedisCommand { +public struct PSYNC: RESPCommand { public typealias Response = RESPToken public var replicationid: String @@ -984,32 +983,32 @@ public struct PSYNC: RedisCommand { self.offset = offset } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("PSYNC", replicationid, offset) } } /// An internal command for configuring the replication stream. -public struct REPLCONF: RedisCommand { +public struct REPLCONF: RESPCommand { public typealias Response = RESPToken @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("REPLCONF") } } /// Configures a server as replica of another, or promotes it to a master. -public struct REPLICAOF: RedisCommand { +public struct REPLICAOF: RESPCommand { public struct ArgsHostPort: RESPRenderable { @usableFromInline let host: String @usableFromInline let port: Int @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += host.encode(into: &commandEncoder) count += port.encode(into: &commandEncoder) @@ -1021,7 +1020,7 @@ public struct REPLICAOF: RedisCommand { @usableFromInline let one: Bool @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 if self.no { count += "NO".encode(into: &commandEncoder) } if self.one { count += "ONE".encode(into: &commandEncoder) } @@ -1033,7 +1032,7 @@ public struct REPLICAOF: RedisCommand { case noOne(ArgsNoOne) @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .hostPort(let hostPort): hostPort.encode(into: &commandEncoder) case .noOne(let noOne): noOne.encode(into: &commandEncoder) @@ -1048,16 +1047,16 @@ public struct REPLICAOF: RedisCommand { self.args = args } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("REPLICAOF", args) } } /// An internal command for migrating keys in a cluster. -public struct RESTOREASKING: RedisCommand { +public struct RESTOREASKING: RESPCommand { public typealias Response = RESPToken - public var key: RedisKey + public var key: RESPKey public var ttl: Int public var serializedValue: String public var replace: Bool = false @@ -1065,7 +1064,7 @@ public struct RESTOREASKING: RedisCommand { public var seconds: Int? = nil public var frequency: Int? = nil - @inlinable public init(key: RedisKey, ttl: Int, serializedValue: String, replace: Bool = false, absttl: Bool = false, seconds: Int? = nil, frequency: Int? = nil) { + @inlinable public init(key: RESPKey, ttl: Int, serializedValue: String, replace: Bool = false, absttl: Bool = false, seconds: Int? = nil, frequency: Int? = nil) { self.key = key self.ttl = ttl self.serializedValue = serializedValue @@ -1075,45 +1074,45 @@ public struct RESTOREASKING: RedisCommand { self.frequency = frequency } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("RESTORE-ASKING", key, ttl, serializedValue, RedisPureToken("REPLACE", replace), RedisPureToken("ABSTTL", absttl), RESPWithToken("IDLETIME", seconds), RESPWithToken("FREQ", frequency)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("RESTORE-ASKING", key, ttl, serializedValue, RESPPureToken("REPLACE", replace), RESPPureToken("ABSTTL", absttl), RESPWithToken("IDLETIME", seconds), RESPWithToken("FREQ", frequency)) } } /// Returns the replication role. -public struct ROLE: RedisCommand { +public struct ROLE: RESPCommand { public typealias Response = [RESPToken] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ROLE") } } /// Synchronously saves the database(s) to disk. -public struct SAVE: RedisCommand { +public struct SAVE: RESPCommand { public typealias Response = RESPToken @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("SAVE") } } -/// Synchronously saves the database(s) to disk and shuts down the Redis server. -public struct SHUTDOWN: RedisCommand { +/// Synchronously saves the database(s) to disk and shuts down the Valkey server. +public struct SHUTDOWN: RESPCommand { public enum SaveSelector: RESPRenderable { case nosave case save @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .nosave: "NOSAVE".encode(into: &commandEncoder) case .save: "SAVE".encode(into: &commandEncoder) @@ -1134,19 +1133,19 @@ public struct SHUTDOWN: RedisCommand { self.abort = abort } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("SHUTDOWN", saveSelector, RedisPureToken("NOW", now), RedisPureToken("FORCE", force), RedisPureToken("ABORT", abort)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("SHUTDOWN", saveSelector, RESPPureToken("NOW", now), RESPPureToken("FORCE", force), RESPPureToken("ABORT", abort)) } } -/// Sets a Redis server as a replica of another, or promotes it to being a master. -public struct SLAVEOF: RedisCommand { +/// Sets a Valkey server as a replica of another, or promotes it to being a master. +public struct SLAVEOF: RESPCommand { public struct ArgsHostPort: RESPRenderable { @usableFromInline let host: String @usableFromInline let port: Int @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += host.encode(into: &commandEncoder) count += port.encode(into: &commandEncoder) @@ -1158,7 +1157,7 @@ public struct SLAVEOF: RedisCommand { @usableFromInline let one: Bool @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 if self.no { count += "NO".encode(into: &commandEncoder) } if self.one { count += "ONE".encode(into: &commandEncoder) } @@ -1170,7 +1169,7 @@ public struct SLAVEOF: RedisCommand { case noOne(ArgsNoOne) @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .hostPort(let hostPort): hostPort.encode(into: &commandEncoder) case .noOne(let noOne): noOne.encode(into: &commandEncoder) @@ -1185,13 +1184,13 @@ public struct SLAVEOF: RedisCommand { self.args = args } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("SLAVEOF", args) } } -/// Swaps two Redis databases. -public struct SWAPDB: RedisCommand { +/// Swaps two Valkey databases. +public struct SWAPDB: RESPCommand { public typealias Response = RESPToken public var index1: Int @@ -1202,48 +1201,48 @@ public struct SWAPDB: RedisCommand { self.index2 = index2 } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("SWAPDB", index1, index2) } } /// An internal command used in replication. -public struct SYNC: RedisCommand { +public struct SYNC: RESPCommand { public typealias Response = RESPToken @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("SYNC") } } /// Returns the server time. -public struct TIME: RedisCommand { +public struct TIME: RESPCommand { public typealias Response = [RESPToken] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("TIME") } } -extension RedisConnection { +extension ValkeyConnection { /// Lists the ACL categories, or the commands inside a category. /// - /// - Documentation: [ACL CAT](https:/redis.io/docs/latest/commands/acl-cat) + /// - Documentation: [ACL CAT](https:/valkey.io/commands/acl-cat) /// - Version: 6.0.0 /// - Complexity: O(1) since the categories and commands are a fixed set. /// - Categories: @slow /// - Returns: One of the following: - /// * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): an array of [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings) elements representing ACL categories or commands in a given category. - /// * [Simple error](https:/redis.io/docs/reference/protocol-spec#simple-errors): the command returns an error if an invalid category name is given. + /// * [Array](https:/valkey.io/topics/protocol/#arrays): an array of [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings) elements representing ACL categories or commands in a given category. + /// * [Simple error](https:/valkey.io/topics/protocol/#simple-errors): the command returns an error if an invalid category name is given. @inlinable public func aclCat(category: String? = nil) async throws -> [String] { try await send(command: ACL.CAT(category: category)) @@ -1251,11 +1250,11 @@ extension RedisConnection { /// Deletes ACL users, and terminates their connections. /// - /// - Documentation: [ACL DELUSER](https:/redis.io/docs/latest/commands/acl-deluser) + /// - Documentation: [ACL DELUSER](https:/valkey.io/commands/acl-deluser) /// - Version: 6.0.0 /// - Complexity: O(1) amortized time considering the typical user. /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of users that were deleted. This number will not always match the number of arguments since certain users may not exist. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of users that were deleted. This number will not always match the number of arguments since certain users may not exist. @inlinable public func aclDeluser(username: [String]) async throws -> Int { try await send(command: ACL.DELUSER(username: username)) @@ -1263,13 +1262,13 @@ extension RedisConnection { /// Simulates the execution of a command by a user, without executing the command. /// - /// - Documentation: [ACL DRYRUN](https:/redis.io/docs/latest/commands/acl-dryrun) + /// - Documentation: [ACL DRYRUN](https:/valkey.io/commands/acl-dryrun) /// - Version: 7.0.0 /// - Complexity: O(1). /// - Categories: @admin, @slow, @dangerous /// - Returns: Any of the following: - /// * [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` on success. - /// * [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): an error describing why the user can't execute the command. + /// * [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` on success. + /// * [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): an error describing why the user can't execute the command. @inlinable public func aclDryrun(username: String, command: String, arg: [String] = []) async throws -> String? { try await send(command: ACL.DRYRUN(username: username, command: command, arg: arg)) @@ -1277,11 +1276,11 @@ extension RedisConnection { /// Generates a pseudorandom, secure password that can be used to identify ACL users. /// - /// - Documentation: [ACL GENPASS](https:/redis.io/docs/latest/commands/acl-genpass) + /// - Documentation: [ACL GENPASS](https:/valkey.io/commands/acl-genpass) /// - Version: 6.0.0 /// - Complexity: O(1) /// - Categories: @slow - /// - Returns: [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): pseudorandom data. By default it contains 64 bytes, representing 256 bits of data. If `bits` was given, the output string length is the number of specified bits (rounded to the next multiple of 4) divided by 4. + /// - Returns: [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): pseudorandom data. By default it contains 64 bytes, representing 256 bits of data. If `bits` was given, the output string length is the number of specified bits (rounded to the next multiple of 4) divided by 4. @inlinable public func aclGenpass(bits: Int? = nil) async throws -> String { try await send(command: ACL.GENPASS(bits: bits)) @@ -1289,13 +1288,13 @@ extension RedisConnection { /// Lists the ACL rules of a user. /// - /// - Documentation: [ACL GETUSER](https:/redis.io/docs/latest/commands/acl-getuser) + /// - Documentation: [ACL GETUSER](https:/valkey.io/commands/acl-getuser) /// - Version: 6.0.0 /// - Complexity: O(N). Where N is the number of password, command and pattern rules that the user has. /// - Categories: @admin, @slow, @dangerous /// - Returns: One of the following: - /// * [Map](https:/redis.io/docs/reference/protocol-spec#maps): a set of ACL rule definitions for the user - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): if user does not exist. + /// * [Map](https:/valkey.io/topics/protocol/#maps): a set of ACL rule definitions for the user + /// * [Null](https:/valkey.io/topics/protocol/#nulls): if user does not exist. @inlinable public func aclGetuser(username: String) async throws -> [String: RESPToken]? { try await send(command: ACL.GETUSER(username: username)) @@ -1303,11 +1302,11 @@ extension RedisConnection { /// Returns helpful text about the different subcommands. /// - /// - Documentation: [ACL HELP](https:/redis.io/docs/latest/commands/acl-help) + /// - Documentation: [ACL HELP](https:/valkey.io/commands/acl-help) /// - Version: 6.0.0 /// - Complexity: O(1) /// - Categories: @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of subcommands and their descriptions. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of subcommands and their descriptions. @inlinable public func aclHelp() async throws -> [RESPToken] { try await send(command: ACL.HELP()) @@ -1315,11 +1314,11 @@ extension RedisConnection { /// Dumps the effective rules in ACL file format. /// - /// - Documentation: [ACL LIST](https:/redis.io/docs/latest/commands/acl-list) + /// - Documentation: [ACL LIST](https:/valkey.io/commands/acl-list) /// - Version: 6.0.0 /// - Complexity: O(N). Where N is the number of configured users. /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): an array of [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings) elements. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): an array of [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings) elements. @inlinable public func aclList() async throws -> [String] { try await send(command: ACL.LIST()) @@ -1327,11 +1326,11 @@ extension RedisConnection { /// Reloads the rules from the configured ACL file. /// - /// - Documentation: [ACL LOAD](https:/redis.io/docs/latest/commands/acl-load) + /// - Documentation: [ACL LOAD](https:/valkey.io/commands/acl-load) /// - Version: 6.0.0 /// - Complexity: O(N). Where N is the number of configured users. /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` on success. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` on success. /// /// The command may fail with an error for several reasons: if the file is not readable, if there is an error inside the file, and in such cases, the error will be reported to the user in the error. /// Finally, the command will fail if the server is not configured to use an external ACL file. @@ -1342,14 +1341,14 @@ extension RedisConnection { /// Lists recent security events generated due to ACL rules. /// - /// - Documentation: [ACL LOG](https:/redis.io/docs/latest/commands/acl-log) + /// - Documentation: [ACL LOG](https:/valkey.io/commands/acl-log) /// - Version: 6.0.0 /// - Complexity: O(N) with N being the number of entries shown. /// - Categories: @admin, @slow, @dangerous /// - Returns: When called to show security events: - /// * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): an array of [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings) elements representing ACL security events. + /// * [Array](https:/valkey.io/topics/protocol/#arrays): an array of [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings) elements representing ACL security events. /// When called with `RESET`: - /// * [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` if the security log was cleared. + /// * [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` if the security log was cleared. @inlinable public func aclLog(operation: ACL.LOG.Operation? = nil) async throws -> [String]? { try await send(command: ACL.LOG(operation: operation)) @@ -1357,11 +1356,11 @@ extension RedisConnection { /// Saves the effective ACL rules in the configured ACL file. /// - /// - Documentation: [ACL SAVE](https:/redis.io/docs/latest/commands/acl-save) + /// - Documentation: [ACL SAVE](https:/valkey.io/commands/acl-save) /// - Version: 6.0.0 /// - Complexity: O(N). Where N is the number of configured users. /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. /// The command may fail with an error for several reasons: if the file cannot be written or if the server is not configured to use an external ACL file. @inlinable public func aclSave() async throws -> RESPToken { @@ -1370,11 +1369,11 @@ extension RedisConnection { /// Creates and modifies an ACL user and its rules. /// - /// - Documentation: [ACL SETUSER](https:/redis.io/docs/latest/commands/acl-setuser) + /// - Documentation: [ACL SETUSER](https:/valkey.io/commands/acl-setuser) /// - Version: 6.0.0 /// - Complexity: O(N). Where N is the number of rules provided. /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. /// If the rules contain errors, the error is returned. @inlinable public func aclSetuser(username: String, rule: [String] = []) async throws -> RESPToken { @@ -1383,11 +1382,11 @@ extension RedisConnection { /// Lists all ACL users. /// - /// - Documentation: [ACL USERS](https:/redis.io/docs/latest/commands/acl-users) + /// - Documentation: [ACL USERS](https:/valkey.io/commands/acl-users) /// - Version: 6.0.0 /// - Complexity: O(N). Where N is the number of configured users. /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): list of existing ACL users. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): list of existing ACL users. @inlinable public func aclUsers() async throws -> [RESPToken] { try await send(command: ACL.USERS()) @@ -1395,11 +1394,11 @@ extension RedisConnection { /// Returns the authenticated username of the current connection. /// - /// - Documentation: [ACL WHOAMI](https:/redis.io/docs/latest/commands/acl-whoami) + /// - Documentation: [ACL WHOAMI](https:/valkey.io/commands/acl-whoami) /// - Version: 6.0.0 /// - Complexity: O(1) /// - Categories: @slow - /// - Returns: [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): the username of the current connection. + /// - Returns: [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): the username of the current connection. @inlinable public func aclWhoami() async throws -> String { try await send(command: ACL.WHOAMI()) @@ -1407,11 +1406,11 @@ extension RedisConnection { /// Asynchronously rewrites the append-only file to disk. /// - /// - Documentation: [BGREWRITEAOF](https:/redis.io/docs/latest/commands/bgrewriteaof) + /// - Documentation: [BGREWRITEAOF](https:/valkey.io/commands/bgrewriteaof) /// - Version: 1.0.0 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): a simple string reply indicating that the rewriting started or is about to start ASAP when the call is executed with success. + /// - Returns: [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): a simple string reply indicating that the rewriting started or is about to start ASAP when the call is executed with success. /// /// The command may reply with an error in certain cases, as documented above. @inlinable @@ -1421,13 +1420,13 @@ extension RedisConnection { /// Asynchronously saves the database(s) to disk. /// - /// - Documentation: [BGSAVE](https:/redis.io/docs/latest/commands/bgsave) + /// - Documentation: [BGSAVE](https:/valkey.io/commands/bgsave) /// - Version: 1.0.0 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous /// - Returns: One of the following: - /// * [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `Background saving started`. - /// * [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `Background saving scheduled`. + /// * [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `Background saving started`. + /// * [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `Background saving scheduled`. @inlinable public func bgsave(schedule: Bool = false) async throws -> String { try await send(command: BGSAVE(schedule: schedule)) @@ -1435,11 +1434,11 @@ extension RedisConnection { /// Returns detailed information about all commands. /// - /// - Documentation: [COMMAND](https:/redis.io/docs/latest/commands/command) + /// - Documentation: [COMMAND](https:/valkey.io/commands/command) /// - Version: 2.8.13 - /// - Complexity: O(N) where N is the total number of Redis commands + /// - Complexity: O(N) where N is the total number of Valkey commands /// - Categories: @slow, @connection - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a nested list of command details. The order of the commands in the array is random. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a nested list of command details. The order of the commands in the array is random. @inlinable public func command() async throws -> [RESPToken] { try await send(command: COMMAND()) @@ -1447,11 +1446,11 @@ extension RedisConnection { /// Returns a count of commands. /// - /// - Documentation: [COMMAND COUNT](https:/redis.io/docs/latest/commands/command-count) + /// - Documentation: [COMMAND COUNT](https:/valkey.io/commands/command-count) /// - Version: 2.8.13 /// - Complexity: O(1) /// - Categories: @slow, @connection - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of commands returned by `COMMAND`. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of commands returned by `COMMAND`. @inlinable public func commandCount() async throws -> Int { try await send(command: COMMAND.COUNT()) @@ -1459,11 +1458,11 @@ extension RedisConnection { /// Returns documentary information about one, multiple or all commands. /// - /// - Documentation: [COMMAND DOCS](https:/redis.io/docs/latest/commands/command-docs) + /// - Documentation: [COMMAND DOCS](https:/valkey.io/commands/command-docs) /// - Version: 7.0.0 /// - Complexity: O(N) where N is the number of commands to look up /// - Categories: @slow, @connection - /// - Returns: [Map](https:/redis.io/docs/reference/protocol-spec#maps): a map where each key is a command name, and each value is the documentary information. + /// - Returns: [Map](https:/valkey.io/topics/protocol/#maps): a map where each key is a command name, and each value is the documentary information. @inlinable public func commandDocs(commandName: [String] = []) async throws -> [String: RESPToken] { try await send(command: COMMAND.DOCS(commandName: commandName)) @@ -1471,11 +1470,11 @@ extension RedisConnection { /// Extracts the key names from an arbitrary command. /// - /// - Documentation: [COMMAND GETKEYS](https:/redis.io/docs/latest/commands/command-getkeys) + /// - Documentation: [COMMAND GETKEYS](https:/valkey.io/commands/command-getkeys) /// - Version: 2.8.13 /// - Complexity: O(N) where N is the number of arguments to the command /// - Categories: @slow, @connection - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of keys from the given command. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of keys from the given command. @inlinable public func commandGetkeys(command: String, arg: [String] = []) async throws -> [RESPToken] { try await send(command: COMMAND.GETKEYS(command: command, arg: arg)) @@ -1483,11 +1482,11 @@ extension RedisConnection { /// Extracts the key names and access flags for an arbitrary command. /// - /// - Documentation: [COMMAND GETKEYSANDFLAGS](https:/redis.io/docs/latest/commands/command-getkeysandflags) + /// - Documentation: [COMMAND GETKEYSANDFLAGS](https:/valkey.io/commands/command-getkeysandflags) /// - Version: 7.0.0 /// - Complexity: O(N) where N is the number of arguments to the command /// - Categories: @slow, @connection - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of keys from the given command and their usage flags. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of keys from the given command and their usage flags. @inlinable public func commandGetkeysandflags(command: String, arg: [String] = []) async throws -> [RESPToken] { try await send(command: COMMAND.GETKEYSANDFLAGS(command: command, arg: arg)) @@ -1495,11 +1494,11 @@ extension RedisConnection { /// Returns helpful text about the different subcommands. /// - /// - Documentation: [COMMAND HELP](https:/redis.io/docs/latest/commands/command-help) + /// - Documentation: [COMMAND HELP](https:/valkey.io/commands/command-help) /// - Version: 5.0.0 /// - Complexity: O(1) /// - Categories: @slow, @connection - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of sub-commands and their descriptions. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of sub-commands and their descriptions. @inlinable public func commandHelp() async throws -> [RESPToken] { try await send(command: COMMAND.HELP()) @@ -1507,11 +1506,11 @@ extension RedisConnection { /// Returns information about one, multiple or all commands. /// - /// - Documentation: [COMMAND INFO](https:/redis.io/docs/latest/commands/command-info) + /// - Documentation: [COMMAND INFO](https:/valkey.io/commands/command-info) /// - Version: 2.8.13 /// - Complexity: O(N) where N is the number of commands to look up /// - Categories: @slow, @connection - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a nested list of command details. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a nested list of command details. @inlinable public func commandInfo(commandName: [String] = []) async throws -> [RESPToken] { try await send(command: COMMAND.INFO(commandName: commandName)) @@ -1519,11 +1518,11 @@ extension RedisConnection { /// Returns a list of command names. /// - /// - Documentation: [COMMAND LIST](https:/redis.io/docs/latest/commands/command-list) + /// - Documentation: [COMMAND LIST](https:/valkey.io/commands/command-list) /// - Version: 7.0.0 - /// - Complexity: O(N) where N is the total number of Redis commands + /// - Complexity: O(N) where N is the total number of Valkey commands /// - Categories: @slow, @connection - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of command names. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of command names. @inlinable public func commandList(filterby: COMMAND.LIST.Filterby? = nil) async throws -> [RESPToken] { try await send(command: COMMAND.LIST(filterby: filterby)) @@ -1531,11 +1530,11 @@ extension RedisConnection { /// Returns the effective values of configuration parameters. /// - /// - Documentation: [CONFIG GET](https:/redis.io/docs/latest/commands/config-get) + /// - Documentation: [CONFIG GET](https:/valkey.io/commands/config-get) /// - Version: 2.0.0 /// - Complexity: O(N) when N is the number of configuration parameters provided /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Map](https:/redis.io/docs/reference/protocol-spec#maps): a list of configuration parameters matching the provided arguments. + /// - Returns: [Map](https:/valkey.io/topics/protocol/#maps): a list of configuration parameters matching the provided arguments. @inlinable public func configGet(parameter: [String]) async throws -> [String: RESPToken] { try await send(command: CONFIG.GET(parameter: parameter)) @@ -1543,11 +1542,11 @@ extension RedisConnection { /// Returns helpful text about the different subcommands. /// - /// - Documentation: [CONFIG HELP](https:/redis.io/docs/latest/commands/config-help) + /// - Documentation: [CONFIG HELP](https:/valkey.io/commands/config-help) /// - Version: 5.0.0 /// - Complexity: O(1) /// - Categories: @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of sub-commands and their descriptions. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of sub-commands and their descriptions. @inlinable public func configHelp() async throws -> [RESPToken] { try await send(command: CONFIG.HELP()) @@ -1555,11 +1554,11 @@ extension RedisConnection { /// Resets the server's statistics. /// - /// - Documentation: [CONFIG RESETSTAT](https:/redis.io/docs/latest/commands/config-resetstat) + /// - Documentation: [CONFIG RESETSTAT](https:/valkey.io/commands/config-resetstat) /// - Version: 2.0.0 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func configResetstat() async throws -> RESPToken { try await send(command: CONFIG.RESETSTAT()) @@ -1567,11 +1566,11 @@ extension RedisConnection { /// Persists the effective configuration to file. /// - /// - Documentation: [CONFIG REWRITE](https:/redis.io/docs/latest/commands/config-rewrite) + /// - Documentation: [CONFIG REWRITE](https:/valkey.io/commands/config-rewrite) /// - Version: 2.8.0 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` when the configuration was rewritten properly. Otherwise an error is returned. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` when the configuration was rewritten properly. Otherwise an error is returned. @inlinable public func configRewrite() async throws -> RESPToken { try await send(command: CONFIG.REWRITE()) @@ -1579,11 +1578,11 @@ extension RedisConnection { /// Sets configuration parameters in-flight. /// - /// - Documentation: [CONFIG SET](https:/redis.io/docs/latest/commands/config-set) + /// - Documentation: [CONFIG SET](https:/valkey.io/commands/config-set) /// - Version: 2.0.0 /// - Complexity: O(N) when N is the number of configuration parameters provided /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` when the configuration was set properly. Otherwise an error is returned. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` when the configuration was set properly. Otherwise an error is returned. @inlinable public func configSet(data: [CONFIG.SET.Data]) async throws -> RESPToken { try await send(command: CONFIG.SET(data: data)) @@ -1591,11 +1590,11 @@ extension RedisConnection { /// Returns the number of keys in the database. /// - /// - Documentation: [DBSIZE](https:/redis.io/docs/latest/commands/dbsize) + /// - Documentation: [DBSIZE](https:/valkey.io/commands/dbsize) /// - Version: 1.0.0 /// - Complexity: O(1) /// - Categories: @keyspace, @read, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of keys in the currently-selected database. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of keys in the currently-selected database. @inlinable public func dbsize() async throws -> Int { try await send(command: DBSIZE()) @@ -1603,11 +1602,11 @@ extension RedisConnection { /// Starts a coordinated failover from a server to one of its replicas. /// - /// - Documentation: [FAILOVER](https:/redis.io/docs/latest/commands/failover) + /// - Documentation: [FAILOVER](https:/valkey.io/commands/failover) /// - Version: 6.2.0 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` if the command was accepted and a coordinated failover is in progress. An error if the operation cannot be executed. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` if the command was accepted and a coordinated failover is in progress. An error if the operation cannot be executed. @inlinable public func failover(target: FAILOVER.Target? = nil, abort: Bool = false, milliseconds: Int? = nil) async throws -> RESPToken { try await send(command: FAILOVER(target: target, abort: abort, milliseconds: milliseconds)) @@ -1615,11 +1614,11 @@ extension RedisConnection { /// Removes all keys from all databases. /// - /// - Documentation: [FLUSHALL](https:/redis.io/docs/latest/commands/flushall) + /// - Documentation: [FLUSHALL](https:/valkey.io/commands/flushall) /// - Version: 1.0.0 /// - Complexity: O(N) where N is the total number of keys in all databases /// - Categories: @keyspace, @write, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func flushall(flushType: FLUSHALL.FlushType? = nil) async throws -> RESPToken { try await send(command: FLUSHALL(flushType: flushType)) @@ -1627,11 +1626,11 @@ extension RedisConnection { /// Remove all keys from the current database. /// - /// - Documentation: [FLUSHDB](https:/redis.io/docs/latest/commands/flushdb) + /// - Documentation: [FLUSHDB](https:/valkey.io/commands/flushdb) /// - Version: 1.0.0 /// - Complexity: O(N) where N is the number of keys in the selected database /// - Categories: @keyspace, @write, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func flushdb(flushType: FLUSHDB.FlushType? = nil) async throws -> RESPToken { try await send(command: FLUSHDB(flushType: flushType)) @@ -1639,11 +1638,11 @@ extension RedisConnection { /// Returns information and statistics about the server. /// - /// - Documentation: [INFO](https:/redis.io/docs/latest/commands/info) + /// - Documentation: [INFO](https:/valkey.io/commands/info) /// - Version: 1.0.0 /// - Complexity: O(1) /// - Categories: @slow, @dangerous - /// - Returns: [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): a map of info fields, one field per line in the form of `:` where the value can be a comma separated map like `=`. Also contains section header lines starting with `#` and blank lines. + /// - Returns: [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): a map of info fields, one field per line in the form of `:` where the value can be a comma separated map like `=`. Also contains section header lines starting with `#` and blank lines. /// /// Lines can contain a section name (starting with a `#` character) or a property. All the properties are in the form of `field:value` terminated by `\r\n`. @inlinable @@ -1653,11 +1652,11 @@ extension RedisConnection { /// Returns the Unix timestamp of the last successful save to disk. /// - /// - Documentation: [LASTSAVE](https:/redis.io/docs/latest/commands/lastsave) + /// - Documentation: [LASTSAVE](https:/valkey.io/commands/lastsave) /// - Version: 1.0.0 /// - Complexity: O(1) /// - Categories: @admin, @fast, @dangerous - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): UNIX TIME of the last DB save executed with success. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): UNIX TIME of the last DB save executed with success. @inlinable public func lastsave() async throws -> Int { try await send(command: LASTSAVE()) @@ -1665,11 +1664,11 @@ extension RedisConnection { /// Returns a human-readable latency analysis report. /// - /// - Documentation: [LATENCY DOCTOR](https:/redis.io/docs/latest/commands/latency-doctor) + /// - Documentation: [LATENCY DOCTOR](https:/valkey.io/commands/latency-doctor) /// - Version: 2.8.13 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Verbatim string](https:/redis.io/docs/reference/protocol-spec#verbatim-strings): a human readable latency analysis report. + /// - Returns: [Verbatim string](https:/valkey.io/topics/protocol/#verbatim-strings): a human readable latency analysis report. @inlinable public func latencyDoctor() async throws -> String { try await send(command: LATENCY.DOCTOR()) @@ -1677,11 +1676,11 @@ extension RedisConnection { /// Returns a latency graph for an event. /// - /// - Documentation: [LATENCY GRAPH](https:/redis.io/docs/latest/commands/latency-graph) + /// - Documentation: [LATENCY GRAPH](https:/valkey.io/commands/latency-graph) /// - Version: 2.8.13 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): Latency graph + /// - Returns: [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): Latency graph @inlinable public func latencyGraph(event: String) async throws -> String { try await send(command: LATENCY.GRAPH(event: event)) @@ -1689,11 +1688,11 @@ extension RedisConnection { /// Returns helpful text about the different subcommands. /// - /// - Documentation: [LATENCY HELP](https:/redis.io/docs/latest/commands/latency-help) + /// - Documentation: [LATENCY HELP](https:/valkey.io/commands/latency-help) /// - Version: 2.8.13 /// - Complexity: O(1) /// - Categories: @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of sub-commands and their descriptions. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of sub-commands and their descriptions. @inlinable public func latencyHelp() async throws -> [RESPToken] { try await send(command: LATENCY.HELP()) @@ -1701,11 +1700,11 @@ extension RedisConnection { /// Returns the cumulative distribution of latencies of a subset or all commands. /// - /// - Documentation: [LATENCY HISTOGRAM](https:/redis.io/docs/latest/commands/latency-histogram) + /// - Documentation: [LATENCY HISTOGRAM](https:/valkey.io/commands/latency-histogram) /// - Version: 7.0.0 /// - Complexity: O(N) where N is the number of commands with latency information being retrieved. /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Map](https:/redis.io/docs/reference/protocol-spec#maps): a map where each key is a command name, and each value is a map with the total calls, and an inner map of the histogram time buckets. + /// - Returns: [Map](https:/valkey.io/topics/protocol/#maps): a map where each key is a command name, and each value is a map with the total calls, and an inner map of the histogram time buckets. @inlinable public func latencyHistogram(command: [String] = []) async throws -> [String: RESPToken] { try await send(command: LATENCY.HISTOGRAM(command: command)) @@ -1713,11 +1712,11 @@ extension RedisConnection { /// Returns timestamp-latency samples for an event. /// - /// - Documentation: [LATENCY HISTORY](https:/redis.io/docs/latest/commands/latency-history) + /// - Documentation: [LATENCY HISTORY](https:/valkey.io/commands/latency-history) /// - Version: 2.8.13 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): an array where each element is a two elements array representing the timestamp and the latency of the event. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): an array where each element is a two elements array representing the timestamp and the latency of the event. @inlinable public func latencyHistory(event: String) async throws -> [RESPToken] { try await send(command: LATENCY.HISTORY(event: event)) @@ -1725,11 +1724,11 @@ extension RedisConnection { /// Returns the latest latency samples for all events. /// - /// - Documentation: [LATENCY LATEST](https:/redis.io/docs/latest/commands/latency-latest) + /// - Documentation: [LATENCY LATEST](https:/valkey.io/commands/latency-latest) /// - Version: 2.8.13 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): an array where each element is a four elements array representing the event's name, timestamp, latest and all-time latency measurements. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): an array where each element is a four elements array representing the event's name, timestamp, latest and all-time latency measurements. @inlinable public func latencyLatest() async throws -> [RESPToken] { try await send(command: LATENCY.LATEST()) @@ -1737,22 +1736,22 @@ extension RedisConnection { /// Resets the latency data for one or more events. /// - /// - Documentation: [LATENCY RESET](https:/redis.io/docs/latest/commands/latency-reset) + /// - Documentation: [LATENCY RESET](https:/valkey.io/commands/latency-reset) /// - Version: 2.8.13 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of event time series that were reset. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of event time series that were reset. @inlinable public func latencyReset(event: [String] = []) async throws -> Int { try await send(command: LATENCY.RESET(event: event)) } - /// Displays computer art and the Redis version + /// Displays computer art and the Valkey version /// - /// - Documentation: [LOLWUT](https:/redis.io/docs/latest/commands/lolwut) + /// - Documentation: [LOLWUT](https:/valkey.io/commands/lolwut) /// - Version: 5.0.0 /// - Categories: @read, @fast - /// - Returns: [Verbatim string](https:/redis.io/docs/reference/protocol-spec#verbatim-strings): a string containing generative computer art and the Redis version. + /// - Returns: [Verbatim string](https:/valkey.io/topics/protocol/#verbatim-strings): a string containing generative computer art and the Valkey version. @inlinable public func lolwut(version: Int? = nil) async throws -> String { try await send(command: LOLWUT(version: version)) @@ -1760,11 +1759,11 @@ extension RedisConnection { /// Outputs a memory problems report. /// - /// - Documentation: [MEMORY DOCTOR](https:/redis.io/docs/latest/commands/memory-doctor) + /// - Documentation: [MEMORY DOCTOR](https:/valkey.io/commands/memory-doctor) /// - Version: 4.0.0 /// - Complexity: O(1) /// - Categories: @slow - /// - Returns: [Verbatim string](https:/redis.io/docs/reference/protocol-spec#verbatim-strings): a memory problems report. + /// - Returns: [Verbatim string](https:/valkey.io/topics/protocol/#verbatim-strings): a memory problems report. @inlinable public func memoryDoctor() async throws -> String { try await send(command: MEMORY.DOCTOR()) @@ -1772,11 +1771,11 @@ extension RedisConnection { /// Returns helpful text about the different subcommands. /// - /// - Documentation: [MEMORY HELP](https:/redis.io/docs/latest/commands/memory-help) + /// - Documentation: [MEMORY HELP](https:/valkey.io/commands/memory-help) /// - Version: 4.0.0 /// - Complexity: O(1) /// - Categories: @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of sub-commands and their descriptions. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of sub-commands and their descriptions. @inlinable public func memoryHelp() async throws -> [RESPToken] { try await send(command: MEMORY.HELP()) @@ -1784,11 +1783,11 @@ extension RedisConnection { /// Returns the allocator statistics. /// - /// - Documentation: [MEMORY MALLOC-STATS](https:/redis.io/docs/latest/commands/memory-malloc-stats) + /// - Documentation: [MEMORY MALLOC-STATS](https:/valkey.io/commands/memory-malloc-stats) /// - Version: 4.0.0 /// - Complexity: Depends on how much memory is allocated, could be slow /// - Categories: @slow - /// - Returns: [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): The memory allocator's internal statistics report. + /// - Returns: [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): the memory allocator's internal statistics report. @inlinable public func memoryMallocStats() async throws -> String { try await send(command: MEMORY.MALLOCSTATS()) @@ -1796,11 +1795,11 @@ extension RedisConnection { /// Asks the allocator to release memory. /// - /// - Documentation: [MEMORY PURGE](https:/redis.io/docs/latest/commands/memory-purge) + /// - Documentation: [MEMORY PURGE](https:/valkey.io/commands/memory-purge) /// - Version: 4.0.0 /// - Complexity: Depends on how much memory is allocated, could be slow /// - Categories: @slow - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func memoryPurge() async throws -> RESPToken { try await send(command: MEMORY.PURGE()) @@ -1808,11 +1807,11 @@ extension RedisConnection { /// Returns details about memory usage. /// - /// - Documentation: [MEMORY STATS](https:/redis.io/docs/latest/commands/memory-stats) + /// - Documentation: [MEMORY STATS](https:/valkey.io/commands/memory-stats) /// - Version: 4.0.0 /// - Complexity: O(1) /// - Categories: @slow - /// - Returns: [Map](https:/redis.io/docs/reference/protocol-spec#maps): memory usage metrics and their values. + /// - Returns: [Map](https:/valkey.io/topics/protocol/#maps): memory usage metrics and their values. @inlinable public func memoryStats() async throws -> [String: RESPToken] { try await send(command: MEMORY.STATS()) @@ -1820,25 +1819,25 @@ extension RedisConnection { /// Estimates the memory usage of a key. /// - /// - Documentation: [MEMORY USAGE](https:/redis.io/docs/latest/commands/memory-usage) + /// - Documentation: [MEMORY USAGE](https:/valkey.io/commands/memory-usage) /// - Version: 4.0.0 /// - Complexity: O(N) where N is the number of samples. /// - Categories: @read, @slow /// - Returns: One of the following: - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the memory usage in bytes. - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): if the key does not exist. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): the memory usage in bytes. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): if the key does not exist. @inlinable - public func memoryUsage(key: RedisKey, count: Int? = nil) async throws -> Int? { + public func memoryUsage(key: RESPKey, count: Int? = nil) async throws -> Int? { try await send(command: MEMORY.USAGE(key: key, count: count)) } /// Returns helpful text about the different subcommands. /// - /// - Documentation: [MODULE HELP](https:/redis.io/docs/latest/commands/module-help) + /// - Documentation: [MODULE HELP](https:/valkey.io/commands/module-help) /// - Version: 5.0.0 /// - Complexity: O(1) /// - Categories: @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of sub-commands and their descriptions + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of sub-commands and their descriptions @inlinable public func moduleHelp() async throws -> [RESPToken] { try await send(command: MODULE.HELP()) @@ -1846,11 +1845,11 @@ extension RedisConnection { /// Returns all loaded modules. /// - /// - Documentation: [MODULE LIST](https:/redis.io/docs/latest/commands/module-list) + /// - Documentation: [MODULE LIST](https:/valkey.io/commands/module-list) /// - Version: 4.0.0 /// - Complexity: O(N) where N is the number of loaded modules. /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): list of loaded modules. Each element in the list represents a represents a module, and is a [Map](https:/redis.io/docs/reference/protocol-spec#maps) of property names and their values. The following properties is reported for each loaded module: + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): list of loaded modules. Each element in the list represents a represents a module, and is a [Map](https:/valkey.io/topics/protocol/#maps) of property names and their values. The following properties is reported for each loaded module: /// * name: the name of the module. /// * ver: the version of the module. @inlinable @@ -1860,11 +1859,11 @@ extension RedisConnection { /// Loads a module. /// - /// - Documentation: [MODULE LOAD](https:/redis.io/docs/latest/commands/module-load) + /// - Documentation: [MODULE LOAD](https:/valkey.io/commands/module-load) /// - Version: 4.0.0 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` if the module was loaded. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` if the module was loaded. @inlinable public func moduleLoad(path: String, arg: [String] = []) async throws -> RESPToken { try await send(command: MODULE.LOAD(path: path, arg: arg)) @@ -1872,11 +1871,11 @@ extension RedisConnection { /// Loads a module using extended parameters. /// - /// - Documentation: [MODULE LOADEX](https:/redis.io/docs/latest/commands/module-loadex) + /// - Documentation: [MODULE LOADEX](https:/valkey.io/commands/module-loadex) /// - Version: 7.0.0 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` if the module was loaded. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` if the module was loaded. @inlinable public func moduleLoadex(path: String, configs: [MODULE.LOADEX.Configs] = [], args: [String] = []) async throws -> RESPToken { try await send(command: MODULE.LOADEX(path: path, configs: configs, args: args)) @@ -1884,11 +1883,11 @@ extension RedisConnection { /// Unloads a module. /// - /// - Documentation: [MODULE UNLOAD](https:/redis.io/docs/latest/commands/module-unload) + /// - Documentation: [MODULE UNLOAD](https:/valkey.io/commands/module-unload) /// - Version: 4.0.0 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` if the module was unloaded. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` if the module was unloaded. @inlinable public func moduleUnload(name: String) async throws -> RESPToken { try await send(command: MODULE.UNLOAD(name: name)) @@ -1896,7 +1895,7 @@ extension RedisConnection { /// Listens for all requests received by the server in real-time. /// - /// - Documentation: [MONITOR](https:/redis.io/docs/latest/commands/monitor) + /// - Documentation: [MONITOR](https:/valkey.io/commands/monitor) /// - Version: 1.0.0 /// - Categories: @admin, @slow, @dangerous /// - Returns: **Non-standard return value**. Dumps the received commands in an infinite flow. @@ -1907,10 +1906,10 @@ extension RedisConnection { /// An internal command used in replication. /// - /// - Documentation: [PSYNC](https:/redis.io/docs/latest/commands/psync) + /// - Documentation: [PSYNC](https:/valkey.io/commands/psync) /// - Version: 2.8.0 /// - Categories: @admin, @slow, @dangerous - /// - Returns: **Non-standard return value**, a bulk transfer of the data followed by `PING` and write requests from the master. + /// - Returns: **Non-standard return value**, a bulk transfer of the data followed by `PING` and write requests from the primary. @inlinable public func psync(replicationid: String, offset: Int) async throws -> RESPToken { try await send(command: PSYNC(replicationid: replicationid, offset: offset)) @@ -1918,11 +1917,11 @@ extension RedisConnection { /// An internal command for configuring the replication stream. /// - /// - Documentation: [REPLCONF](https:/redis.io/docs/latest/commands/replconf) + /// - Documentation: [REPLCONF](https:/valkey.io/commands/replconf) /// - Version: 3.0.0 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func replconf() async throws -> RESPToken { try await send(command: REPLCONF()) @@ -1930,11 +1929,11 @@ extension RedisConnection { /// Configures a server as replica of another, or promotes it to a master. /// - /// - Documentation: [REPLICAOF](https:/redis.io/docs/latest/commands/replicaof) + /// - Documentation: [REPLICAOF](https:/valkey.io/commands/replicaof) /// - Version: 5.0.0 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func replicaof(args: REPLICAOF.Args) async throws -> RESPToken { try await send(command: REPLICAOF(args: args)) @@ -1942,23 +1941,23 @@ extension RedisConnection { /// An internal command for migrating keys in a cluster. /// - /// - Documentation: [RESTORE-ASKING](https:/redis.io/docs/latest/commands/restore-asking) + /// - Documentation: [RESTORE-ASKING](https:/valkey.io/commands/restore-asking) /// - Version: 3.0.0 - /// - Complexity: O(1) to create the new key and additional O(N*M) to reconstruct the serialized value, where N is the number of Redis objects composing the value and M their average size. For small string values the time complexity is thus O(1)+O(1*M) where M is small, so simply O(1). However for sorted set values the complexity is O(N*M*log(N)) because inserting values into sorted sets is O(log(N)). + /// - Complexity: O(1) to create the new key and additional O(N*M) to reconstruct the serialized value, where N is the number of Valkey objects composing the value and M their average size. For small string values the time complexity is thus O(1)+O(1*M) where M is small, so simply O(1). However for sorted set values the complexity is O(N*M*log(N)) because inserting values into sorted sets is O(log(N)). /// - Categories: @keyspace, @write, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable - public func restoreAsking(key: RedisKey, ttl: Int, serializedValue: String, replace: Bool = false, absttl: Bool = false, seconds: Int? = nil, frequency: Int? = nil) async throws -> RESPToken { + public func restoreAsking(key: RESPKey, ttl: Int, serializedValue: String, replace: Bool = false, absttl: Bool = false, seconds: Int? = nil, frequency: Int? = nil) async throws -> RESPToken { try await send(command: RESTOREASKING(key: key, ttl: ttl, serializedValue: serializedValue, replace: replace, absttl: absttl, seconds: seconds, frequency: frequency)) } /// Returns the replication role. /// - /// - Documentation: [ROLE](https:/redis.io/docs/latest/commands/role) + /// - Documentation: [ROLE](https:/valkey.io/commands/role) /// - Version: 2.8.12 /// - Complexity: O(1) /// - Categories: @admin, @fast, @dangerous - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): where the first element is one of `master`, `slave`, or `sentinel`, and the additional elements are role-specific as illustrated above. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): where the first element is one of `master`, `slave`, or `sentinel`, and the additional elements are role-specific as illustrated above. @inlinable public func role() async throws -> [RESPToken] { try await send(command: ROLE()) @@ -1966,35 +1965,35 @@ extension RedisConnection { /// Synchronously saves the database(s) to disk. /// - /// - Documentation: [SAVE](https:/redis.io/docs/latest/commands/save) + /// - Documentation: [SAVE](https:/valkey.io/commands/save) /// - Version: 1.0.0 /// - Complexity: O(N) where N is the total number of keys in all databases /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func save() async throws -> RESPToken { try await send(command: SAVE()) } - /// Synchronously saves the database(s) to disk and shuts down the Redis server. + /// Synchronously saves the database(s) to disk and shuts down the Valkey server. /// - /// - Documentation: [SHUTDOWN](https:/redis.io/docs/latest/commands/shutdown) + /// - Documentation: [SHUTDOWN](https:/valkey.io/commands/shutdown) /// - Version: 1.0.0 /// - Complexity: O(N) when saving, where N is the total number of keys in all databases when saving data, otherwise O(1) /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK` if _ABORT_ was specified and shutdown was aborted. On successful shutdown, nothing is returned because the server quits and the connection is closed. On failure, an error is returned. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK` if _ABORT_ was specified and shutdown was aborted. On successful shutdown, nothing is returned because the server quits and the connection is closed. On failure, an error is returned. @inlinable public func shutdown(saveSelector: SHUTDOWN.SaveSelector? = nil, now: Bool = false, force: Bool = false, abort: Bool = false) async throws -> RESPToken { try await send(command: SHUTDOWN(saveSelector: saveSelector, now: now, force: force, abort: abort)) } - /// Sets a Redis server as a replica of another, or promotes it to being a master. + /// Sets a Valkey server as a replica of another, or promotes it to being a master. /// - /// - Documentation: [SLAVEOF](https:/redis.io/docs/latest/commands/slaveof) + /// - Documentation: [SLAVEOF](https:/valkey.io/commands/slaveof) /// - Version: 1.0.0 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func slaveof(args: SLAVEOF.Args) async throws -> RESPToken { try await send(command: SLAVEOF(args: args)) @@ -2002,11 +2001,11 @@ extension RedisConnection { /// Returns the slow log's entries. /// - /// - Documentation: [SLOWLOG GET](https:/redis.io/docs/latest/commands/slowlog-get) + /// - Documentation: [SLOWLOG GET](https:/valkey.io/commands/slowlog-get) /// - Version: 2.2.12 /// - Complexity: O(N) where N is the number of entries returned /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of slow log entries per the above format. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of slow log entries per the above format. @inlinable public func slowlogGet(count: Int? = nil) async throws -> [RESPToken] { try await send(command: SLOWLOG.GET(count: count)) @@ -2014,11 +2013,11 @@ extension RedisConnection { /// Show helpful text about the different subcommands /// - /// - Documentation: [SLOWLOG HELP](https:/redis.io/docs/latest/commands/slowlog-help) + /// - Documentation: [SLOWLOG HELP](https:/valkey.io/commands/slowlog-help) /// - Version: 6.2.0 /// - Complexity: O(1) /// - Categories: @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of sub-commands and their descriptions. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of sub-commands and their descriptions. @inlinable public func slowlogHelp() async throws -> [RESPToken] { try await send(command: SLOWLOG.HELP()) @@ -2026,11 +2025,11 @@ extension RedisConnection { /// Returns the number of entries in the slow log. /// - /// - Documentation: [SLOWLOG LEN](https:/redis.io/docs/latest/commands/slowlog-len) + /// - Documentation: [SLOWLOG LEN](https:/valkey.io/commands/slowlog-len) /// - Version: 2.2.12 /// - Complexity: O(1) /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of entries in the slow log. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of entries in the slow log. @inlinable public func slowlogLen() async throws -> Int { try await send(command: SLOWLOG.LEN()) @@ -2038,23 +2037,23 @@ extension RedisConnection { /// Clears all entries from the slow log. /// - /// - Documentation: [SLOWLOG RESET](https:/redis.io/docs/latest/commands/slowlog-reset) + /// - Documentation: [SLOWLOG RESET](https:/valkey.io/commands/slowlog-reset) /// - Version: 2.2.12 /// - Complexity: O(N) where N is the number of entries in the slowlog /// - Categories: @admin, @slow, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func slowlogReset() async throws -> RESPToken { try await send(command: SLOWLOG.RESET()) } - /// Swaps two Redis databases. + /// Swaps two Valkey databases. /// - /// - Documentation: [SWAPDB](https:/redis.io/docs/latest/commands/swapdb) + /// - Documentation: [SWAPDB](https:/valkey.io/commands/swapdb) /// - Version: 4.0.0 /// - Complexity: O(N) where N is the count of clients watching or blocking on keys from both databases. /// - Categories: @keyspace, @write, @fast, @dangerous - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func swapdb(index1: Int, index2: Int) async throws -> RESPToken { try await send(command: SWAPDB(index1: index1, index2: index2)) @@ -2062,10 +2061,10 @@ extension RedisConnection { /// An internal command used in replication. /// - /// - Documentation: [SYNC](https:/redis.io/docs/latest/commands/sync) + /// - Documentation: [SYNC](https:/valkey.io/commands/sync) /// - Version: 1.0.0 /// - Categories: @admin, @slow, @dangerous - /// - Returns: **Non-standard return value**, a bulk transfer of the data followed by `PING` and write requests from the master. + /// - Returns: **Non-standard return value**, a bulk transfer of the data followed by `PING` and write requests from the primary. @inlinable public func sync() async throws -> RESPToken { try await send(command: SYNC()) @@ -2073,11 +2072,11 @@ extension RedisConnection { /// Returns the server time. /// - /// - Documentation: [TIME](https:/redis.io/docs/latest/commands/time) + /// - Documentation: [TIME](https:/valkey.io/commands/time) /// - Version: 2.6.0 /// - Complexity: O(1) /// - Categories: @fast - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): specifically, a two-element array consisting of the Unix timestamp in seconds and the microseconds' count. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): specifically, a two-element array consisting of the Unix timestamp in seconds and the microseconds' count. @inlinable public func time() async throws -> [RESPToken] { try await send(command: TIME()) diff --git a/Sources/Valkey/Commands/SetCommands.swift b/Sources/Valkey/Commands/SetCommands.swift new file mode 100644 index 00000000..ba42b517 --- /dev/null +++ b/Sources/Valkey/Commands/SetCommands.swift @@ -0,0 +1,527 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the swift-valkey open source project +// +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors +// Licensed under Apache License v2.0 +// +// See LICENSE.txt for license information +// See CONTRIBUTORS.txt for the list of swift-valkey project authors +// +// SPDX-License-Identifier: Apache-2.0 +// +//===----------------------------------------------------------------------===// + +// This file is autogenerated by ValkeyCommandsBuilder + +import NIOCore + +#if canImport(FoundationEssentials) +import FoundationEssentials +#else +import Foundation +#endif + +/// Adds one or more members to a set. Creates the key if it doesn't exist. +public struct SADD: RESPCommand { + public typealias Response = Int + + public var key: RESPKey + public var member: [String] + + @inlinable public init(key: RESPKey, member: [String]) { + self.key = key + self.member = member + } + + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("SADD", key, member) + } +} + +/// Returns the number of members in a set. +public struct SCARD: RESPCommand { + public typealias Response = Int + + public var key: RESPKey + + @inlinable public init(key: RESPKey) { + self.key = key + } + + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("SCARD", key) + } +} + +/// Returns the difference of multiple sets. +public struct SDIFF: RESPCommand { + public typealias Response = RESPToken + + public var key: [RESPKey] + + @inlinable public init(key: [RESPKey]) { + self.key = key + } + + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("SDIFF", key) + } +} + +/// Stores the difference of multiple sets in a key. +public struct SDIFFSTORE: RESPCommand { + public typealias Response = Int + + public var destination: RESPKey + public var key: [RESPKey] + + @inlinable public init(destination: RESPKey, key: [RESPKey]) { + self.destination = destination + self.key = key + } + + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("SDIFFSTORE", destination, key) + } +} + +/// Returns the intersect of multiple sets. +public struct SINTER: RESPCommand { + public typealias Response = RESPToken + + public var key: [RESPKey] + + @inlinable public init(key: [RESPKey]) { + self.key = key + } + + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("SINTER", key) + } +} + +/// Returns the number of members of the intersect of multiple sets. +public struct SINTERCARD: RESPCommand { + public typealias Response = Int + + public var key: [RESPKey] + public var limit: Int? = nil + + @inlinable public init(key: [RESPKey], limit: Int? = nil) { + self.key = key + self.limit = limit + } + + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("SINTERCARD", RESPArrayWithCount(key), RESPWithToken("LIMIT", limit)) + } +} + +/// Stores the intersect of multiple sets in a key. +public struct SINTERSTORE: RESPCommand { + public typealias Response = Int + + public var destination: RESPKey + public var key: [RESPKey] + + @inlinable public init(destination: RESPKey, key: [RESPKey]) { + self.destination = destination + self.key = key + } + + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("SINTERSTORE", destination, key) + } +} + +/// Determines whether a member belongs to a set. +public struct SISMEMBER: RESPCommand { + public typealias Response = Int + + public var key: RESPKey + public var member: String + + @inlinable public init(key: RESPKey, member: String) { + self.key = key + self.member = member + } + + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("SISMEMBER", key, member) + } +} + +/// Returns all members of a set. +public struct SMEMBERS: RESPCommand { + public typealias Response = RESPToken + + public var key: RESPKey + + @inlinable public init(key: RESPKey) { + self.key = key + } + + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("SMEMBERS", key) + } +} + +/// Determines whether multiple members belong to a set. +public struct SMISMEMBER: RESPCommand { + public typealias Response = [RESPToken] + + public var key: RESPKey + public var member: [String] + + @inlinable public init(key: RESPKey, member: [String]) { + self.key = key + self.member = member + } + + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("SMISMEMBER", key, member) + } +} + +/// Moves a member from one set to another. +public struct SMOVE: RESPCommand { + public typealias Response = Int + + public var source: RESPKey + public var destination: RESPKey + public var member: String + + @inlinable public init(source: RESPKey, destination: RESPKey, member: String) { + self.source = source + self.destination = destination + self.member = member + } + + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("SMOVE", source, destination, member) + } +} + +/// Returns one or more random members from a set after removing them. Deletes the set if the last member was popped. +public struct SPOP: RESPCommand { + public typealias Response = RESPToken + + public var key: RESPKey + public var count: Int? = nil + + @inlinable public init(key: RESPKey, count: Int? = nil) { + self.key = key + self.count = count + } + + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("SPOP", key, count) + } +} + +/// Get one or multiple random members from a set +public struct SRANDMEMBER: RESPCommand { + public typealias Response = RESPToken + + public var key: RESPKey + public var count: Int? = nil + + @inlinable public init(key: RESPKey, count: Int? = nil) { + self.key = key + self.count = count + } + + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("SRANDMEMBER", key, count) + } +} + +/// Removes one or more members from a set. Deletes the set if the last member was removed. +public struct SREM: RESPCommand { + public typealias Response = Int + + public var key: RESPKey + public var member: [String] + + @inlinable public init(key: RESPKey, member: [String]) { + self.key = key + self.member = member + } + + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("SREM", key, member) + } +} + +/// Iterates over members of a set. +public struct SSCAN: RESPCommand { + public typealias Response = [RESPToken] + + public var key: RESPKey + public var cursor: Int + public var pattern: String? = nil + public var count: Int? = nil + + @inlinable public init(key: RESPKey, cursor: Int, pattern: String? = nil, count: Int? = nil) { + self.key = key + self.cursor = cursor + self.pattern = pattern + self.count = count + } + + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("SSCAN", key, cursor, RESPWithToken("MATCH", pattern), RESPWithToken("COUNT", count)) + } +} + +/// Returns the union of multiple sets. +public struct SUNION: RESPCommand { + public typealias Response = RESPToken + + public var key: [RESPKey] + + @inlinable public init(key: [RESPKey]) { + self.key = key + } + + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("SUNION", key) + } +} + +/// Stores the union of multiple sets in a key. +public struct SUNIONSTORE: RESPCommand { + public typealias Response = Int + + public var destination: RESPKey + public var key: [RESPKey] + + @inlinable public init(destination: RESPKey, key: [RESPKey]) { + self.destination = destination + self.key = key + } + + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("SUNIONSTORE", destination, key) + } +} + + +extension ValkeyConnection { + /// Adds one or more members to a set. Creates the key if it doesn't exist. + /// + /// - Documentation: [SADD](https:/valkey.io/commands/sadd) + /// - Version: 1.0.0 + /// - Complexity: O(1) for each element added, so O(N) to add N elements when the command is called with multiple arguments. + /// - Categories: @write, @set, @fast + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of elements that were added to the set, not including all the elements already present in the set. + @inlinable + public func sadd(key: RESPKey, member: [String]) async throws -> Int { + try await send(command: SADD(key: key, member: member)) + } + + /// Returns the number of members in a set. + /// + /// - Documentation: [SCARD](https:/valkey.io/commands/scard) + /// - Version: 1.0.0 + /// - Complexity: O(1) + /// - Categories: @read, @set, @fast + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the cardinality (number of elements) of the set, or `0` if the key does not exist. + @inlinable + public func scard(key: RESPKey) async throws -> Int { + try await send(command: SCARD(key: key)) + } + + /// Returns the difference of multiple sets. + /// + /// - Documentation: [SDIFF](https:/valkey.io/commands/sdiff) + /// - Version: 1.0.0 + /// - Complexity: O(N) where N is the total number of elements in all given sets. + /// - Categories: @read, @set, @slow + /// - Returns: [Set](https:/valkey.io/topics/protocol/#sets): the resulting set. + @inlinable + public func sdiff(key: [RESPKey]) async throws -> RESPToken { + try await send(command: SDIFF(key: key)) + } + + /// Stores the difference of multiple sets in a key. + /// + /// - Documentation: [SDIFFSTORE](https:/valkey.io/commands/sdiffstore) + /// - Version: 1.0.0 + /// - Complexity: O(N) where N is the total number of elements in all given sets. + /// - Categories: @write, @set, @slow + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of elements in the resulting set. + @inlinable + public func sdiffstore(destination: RESPKey, key: [RESPKey]) async throws -> Int { + try await send(command: SDIFFSTORE(destination: destination, key: key)) + } + + /// Returns the intersect of multiple sets. + /// + /// - Documentation: [SINTER](https:/valkey.io/commands/sinter) + /// - Version: 1.0.0 + /// - Complexity: O(N*M) worst case where N is the cardinality of the smallest set and M is the number of sets. + /// - Categories: @read, @set, @slow + /// - Returns: [Set](https:/valkey.io/topics/protocol/#sets): the resulting set. + @inlinable + public func sinter(key: [RESPKey]) async throws -> RESPToken { + try await send(command: SINTER(key: key)) + } + + /// Returns the number of members of the intersect of multiple sets. + /// + /// - Documentation: [SINTERCARD](https:/valkey.io/commands/sintercard) + /// - Version: 7.0.0 + /// - Complexity: O(N*M) worst case where N is the cardinality of the smallest set and M is the number of sets. + /// - Categories: @read, @set, @slow + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of elements in the resulting intersection. + @inlinable + public func sintercard(key: [RESPKey], limit: Int? = nil) async throws -> Int { + try await send(command: SINTERCARD(key: key, limit: limit)) + } + + /// Stores the intersect of multiple sets in a key. + /// + /// - Documentation: [SINTERSTORE](https:/valkey.io/commands/sinterstore) + /// - Version: 1.0.0 + /// - Complexity: O(N*M) worst case where N is the cardinality of the smallest set and M is the number of sets. + /// - Categories: @write, @set, @slow + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of elements in the resulting set. + @inlinable + public func sinterstore(destination: RESPKey, key: [RESPKey]) async throws -> Int { + try await send(command: SINTERSTORE(destination: destination, key: key)) + } + + /// Determines whether a member belongs to a set. + /// + /// - Documentation: [SISMEMBER](https:/valkey.io/commands/sismember) + /// - Version: 1.0.0 + /// - Complexity: O(1) + /// - Categories: @read, @set, @fast + /// - Returns: One of the following: + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `0` if the element is not a member of the set, or when the key does not exist. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `1` if the element is a member of the set. + @inlinable + public func sismember(key: RESPKey, member: String) async throws -> Int { + try await send(command: SISMEMBER(key: key, member: member)) + } + + /// Returns all members of a set. + /// + /// - Documentation: [SMEMBERS](https:/valkey.io/commands/smembers) + /// - Version: 1.0.0 + /// - Complexity: O(N) where N is the set cardinality. + /// - Categories: @read, @set, @slow + /// - Returns: [Set](https:/valkey.io/topics/protocol/#sets): all members of the set. + @inlinable + public func smembers(key: RESPKey) async throws -> RESPToken { + try await send(command: SMEMBERS(key: key)) + } + + /// Determines whether multiple members belong to a set. + /// + /// - Documentation: [SMISMEMBER](https:/valkey.io/commands/smismember) + /// - Version: 6.2.0 + /// - Complexity: O(N) where N is the number of elements being checked for membership + /// - Categories: @read, @set, @fast + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list representing the membership of the given elements, in the same order as they are requested. + @inlinable + public func smismember(key: RESPKey, member: [String]) async throws -> [RESPToken] { + try await send(command: SMISMEMBER(key: key, member: member)) + } + + /// Moves a member from one set to another. + /// + /// - Documentation: [SMOVE](https:/valkey.io/commands/smove) + /// - Version: 1.0.0 + /// - Complexity: O(1) + /// - Categories: @write, @set, @fast + /// - Returns: One of the following: + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `1` if the element is moved. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `0` if the element is not a member of _source_ and no operation was performed. + @inlinable + public func smove(source: RESPKey, destination: RESPKey, member: String) async throws -> Int { + try await send(command: SMOVE(source: source, destination: destination, member: member)) + } + + /// Returns one or more random members from a set after removing them. Deletes the set if the last member was popped. + /// + /// - Documentation: [SPOP](https:/valkey.io/commands/spop) + /// - Version: 1.0.0 + /// - Complexity: Without the count argument O(1), otherwise O(N) where N is the value of the passed count. + /// - Categories: @write, @set, @fast + /// - Returns: One of the following: + /// * [Null](https:/valkey.io/topics/protocol/#nulls): if the key does not exist. + /// * [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): when called without the _count_ argument, the removed member. + /// * [Set](https:/valkey.io/topics/protocol/#sets): when called with the _count_ argument, the set of removed members. + @inlinable + public func spop(key: RESPKey, count: Int? = nil) async throws -> RESPToken { + try await send(command: SPOP(key: key, count: count)) + } + + /// Get one or multiple random members from a set + /// + /// - Documentation: [SRANDMEMBER](https:/valkey.io/commands/srandmember) + /// - Version: 1.0.0 + /// - Complexity: Without the count argument O(1), otherwise O(N) where N is the absolute value of the passed count. + /// - Categories: @read, @set, @slow + /// - Returns: One of the following: + /// * [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): without the additional _count_ argument, the command returns a randomly selected member, or a [Null](https:/valkey.io/topics/protocol/#nulls) when _key_ doesn't exist. + /// * [Array](https:/valkey.io/topics/protocol/#arrays): when the optional _count_ argument is passed, the command returns an array of members, or an empty array when _key_ doesn't exist. + @inlinable + public func srandmember(key: RESPKey, count: Int? = nil) async throws -> RESPToken { + try await send(command: SRANDMEMBER(key: key, count: count)) + } + + /// Removes one or more members from a set. Deletes the set if the last member was removed. + /// + /// - Documentation: [SREM](https:/valkey.io/commands/srem) + /// - Version: 1.0.0 + /// - Complexity: O(N) where N is the number of members to be removed. + /// - Categories: @write, @set, @fast + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of members that were removed from the set, not including non existing members. + @inlinable + public func srem(key: RESPKey, member: [String]) async throws -> Int { + try await send(command: SREM(key: key, member: member)) + } + + /// Iterates over members of a set. + /// + /// - Documentation: [SSCAN](https:/valkey.io/commands/sscan) + /// - Version: 2.8.0 + /// - Complexity: O(1) for every call. O(N) for a complete iteration, including enough command calls for the cursor to return back to 0. N is the number of elements inside the collection. + /// - Categories: @read, @set, @slow + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): specifically, an array with two elements: + /// * The first element is a [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings) that represents an unsigned 64-bit number, the cursor. + /// * The second element is an [Array](https:/valkey.io/topics/protocol/#arrays) with the names of scanned members. + @inlinable + public func sscan(key: RESPKey, cursor: Int, pattern: String? = nil, count: Int? = nil) async throws -> [RESPToken] { + try await send(command: SSCAN(key: key, cursor: cursor, pattern: pattern, count: count)) + } + + /// Returns the union of multiple sets. + /// + /// - Documentation: [SUNION](https:/valkey.io/commands/sunion) + /// - Version: 1.0.0 + /// - Complexity: O(N) where N is the total number of elements in all given sets. + /// - Categories: @read, @set, @slow + /// - Returns: [Set](https:/valkey.io/topics/protocol/#sets): the resulting set. + @inlinable + public func sunion(key: [RESPKey]) async throws -> RESPToken { + try await send(command: SUNION(key: key)) + } + + /// Stores the union of multiple sets in a key. + /// + /// - Documentation: [SUNIONSTORE](https:/valkey.io/commands/sunionstore) + /// - Version: 1.0.0 + /// - Complexity: O(N) where N is the total number of elements in all given sets. + /// - Categories: @write, @set, @slow + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of elements in the resulting set. + @inlinable + public func sunionstore(destination: RESPKey, key: [RESPKey]) async throws -> Int { + try await send(command: SUNIONSTORE(destination: destination, key: key)) + } + +} diff --git a/Sources/RedisCommands/SortedSetCommands.swift b/Sources/Valkey/Commands/SortedSetCommands.swift similarity index 57% rename from Sources/RedisCommands/SortedSetCommands.swift rename to Sources/Valkey/Commands/SortedSetCommands.swift index 5e898392..71f50693 100644 --- a/Sources/RedisCommands/SortedSetCommands.swift +++ b/Sources/Valkey/Commands/SortedSetCommands.swift @@ -1,21 +1,20 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -// This file is autogenerated by RedisCommandsBuilder +// This file is autogenerated by ValkeyCommandsBuilder import NIOCore -import Redis #if canImport(FoundationEssentials) import FoundationEssentials @@ -24,13 +23,13 @@ import Foundation #endif /// Removes and returns a member by score from one or more sorted sets. Blocks until a member is available otherwise. Deletes the sorted set if the last element was popped. -public struct BZMPOP: RedisCommand { +public struct BZMPOP: RESPCommand { public enum Where: RESPRenderable { case min case max @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .min: "MIN".encode(into: &commandEncoder) case .max: "MAX".encode(into: &commandEncoder) @@ -40,64 +39,64 @@ public struct BZMPOP: RedisCommand { public typealias Response = [RESPToken]? public var timeout: Double - public var key: [RedisKey] + public var key: [RESPKey] public var `where`: Where public var count: Int? = nil - @inlinable public init(timeout: Double, key: [RedisKey], `where`: Where, count: Int? = nil) { + @inlinable public init(timeout: Double, key: [RESPKey], `where`: Where, count: Int? = nil) { self.timeout = timeout self.key = key self.`where` = `where` self.count = count } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("BZMPOP", timeout, RESPArrayWithCount(key), `where`, RESPWithToken("COUNT", count)) } } /// Removes and returns the member with the highest score from one or more sorted sets. Blocks until a member available otherwise. Deletes the sorted set if the last element was popped. -public struct BZPOPMAX: RedisCommand { +public struct BZPOPMAX: RESPCommand { public typealias Response = [RESPToken]? - public var key: [RedisKey] + public var key: [RESPKey] public var timeout: Double - @inlinable public init(key: [RedisKey], timeout: Double) { + @inlinable public init(key: [RESPKey], timeout: Double) { self.key = key self.timeout = timeout } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("BZPOPMAX", key, timeout) } } /// Removes and returns the member with the lowest score from one or more sorted sets. Blocks until a member is available otherwise. Deletes the sorted set if the last element was popped. -public struct BZPOPMIN: RedisCommand { +public struct BZPOPMIN: RESPCommand { public typealias Response = [RESPToken]? - public var key: [RedisKey] + public var key: [RESPKey] public var timeout: Double - @inlinable public init(key: [RedisKey], timeout: Double) { + @inlinable public init(key: [RESPKey], timeout: Double) { self.key = key self.timeout = timeout } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("BZPOPMIN", key, timeout) } } /// Adds one or more members to a sorted set, or updates their scores. Creates the key if it doesn't exist. -public struct ZADD: RedisCommand { +public struct ZADD: RESPCommand { public enum Condition: RESPRenderable { case nx case xx @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .nx: "NX".encode(into: &commandEncoder) case .xx: "XX".encode(into: &commandEncoder) @@ -109,7 +108,7 @@ public struct ZADD: RedisCommand { case lt @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .gt: "GT".encode(into: &commandEncoder) case .lt: "LT".encode(into: &commandEncoder) @@ -121,7 +120,7 @@ public struct ZADD: RedisCommand { @usableFromInline let member: String @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += score.encode(into: &commandEncoder) count += member.encode(into: &commandEncoder) @@ -130,14 +129,14 @@ public struct ZADD: RedisCommand { } public typealias Response = RESPToken - public var key: RedisKey + public var key: RESPKey public var condition: Condition? = nil public var comparison: Comparison? = nil public var change: Bool = false public var increment: Bool = false public var data: [Data] - @inlinable public init(key: RedisKey, condition: Condition? = nil, comparison: Comparison? = nil, change: Bool = false, increment: Bool = false, data: [Data]) { + @inlinable public init(key: RESPKey, condition: Condition? = nil, comparison: Comparison? = nil, change: Bool = false, increment: Bool = false, data: [Data]) { self.key = key self.condition = condition self.comparison = comparison @@ -146,107 +145,107 @@ public struct ZADD: RedisCommand { self.data = data } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("ZADD", key, condition, comparison, RedisPureToken("CH", change), RedisPureToken("INCR", increment), data) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("ZADD", key, condition, comparison, RESPPureToken("CH", change), RESPPureToken("INCR", increment), data) } } /// Returns the number of members in a sorted set. -public struct ZCARD: RedisCommand { +public struct ZCARD: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey - @inlinable public init(key: RedisKey) { + @inlinable public init(key: RESPKey) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ZCARD", key) } } /// Returns the count of members in a sorted set that have scores within a range. -public struct ZCOUNT: RedisCommand { +public struct ZCOUNT: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var min: Double public var max: Double - @inlinable public init(key: RedisKey, min: Double, max: Double) { + @inlinable public init(key: RESPKey, min: Double, max: Double) { self.key = key self.min = min self.max = max } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ZCOUNT", key, min, max) } } /// Returns the difference between multiple sorted sets. -public struct ZDIFF: RedisCommand { +public struct ZDIFF: RESPCommand { public typealias Response = [RESPToken] - public var key: [RedisKey] + public var key: [RESPKey] public var withscores: Bool = false - @inlinable public init(key: [RedisKey], withscores: Bool = false) { + @inlinable public init(key: [RESPKey], withscores: Bool = false) { self.key = key self.withscores = withscores } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("ZDIFF", RESPArrayWithCount(key), RedisPureToken("WITHSCORES", withscores)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("ZDIFF", RESPArrayWithCount(key), RESPPureToken("WITHSCORES", withscores)) } } /// Stores the difference of multiple sorted sets in a key. -public struct ZDIFFSTORE: RedisCommand { +public struct ZDIFFSTORE: RESPCommand { public typealias Response = Int - public var destination: RedisKey - public var key: [RedisKey] + public var destination: RESPKey + public var key: [RESPKey] - @inlinable public init(destination: RedisKey, key: [RedisKey]) { + @inlinable public init(destination: RESPKey, key: [RESPKey]) { self.destination = destination self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ZDIFFSTORE", destination, RESPArrayWithCount(key)) } } /// Increments the score of a member in a sorted set. -public struct ZINCRBY: RedisCommand { +public struct ZINCRBY: RESPCommand { public typealias Response = Double - public var key: RedisKey + public var key: RESPKey public var increment: Int public var member: String - @inlinable public init(key: RedisKey, increment: Int, member: String) { + @inlinable public init(key: RESPKey, increment: Int, member: String) { self.key = key self.increment = increment self.member = member } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ZINCRBY", key, increment, member) } } /// Returns the intersect of multiple sorted sets. -public struct ZINTER: RedisCommand { +public struct ZINTER: RESPCommand { public enum Aggregate: RESPRenderable { case sum case min case max @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .sum: "SUM".encode(into: &commandEncoder) case .min: "MIN".encode(into: &commandEncoder) @@ -256,49 +255,49 @@ public struct ZINTER: RedisCommand { } public typealias Response = [RESPToken] - public var key: [RedisKey] + public var key: [RESPKey] public var weight: [Int] = [] public var aggregate: Aggregate? = nil public var withscores: Bool = false - @inlinable public init(key: [RedisKey], weight: [Int] = [], aggregate: Aggregate? = nil, withscores: Bool = false) { + @inlinable public init(key: [RESPKey], weight: [Int] = [], aggregate: Aggregate? = nil, withscores: Bool = false) { self.key = key self.weight = weight self.aggregate = aggregate self.withscores = withscores } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("ZINTER", RESPArrayWithCount(key), RESPWithToken("WEIGHTS", weight), RESPWithToken("AGGREGATE", aggregate), RedisPureToken("WITHSCORES", withscores)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("ZINTER", RESPArrayWithCount(key), RESPWithToken("WEIGHTS", weight), RESPWithToken("AGGREGATE", aggregate), RESPPureToken("WITHSCORES", withscores)) } } /// Returns the number of members of the intersect of multiple sorted sets. -public struct ZINTERCARD: RedisCommand { +public struct ZINTERCARD: RESPCommand { public typealias Response = Int - public var key: [RedisKey] + public var key: [RESPKey] public var limit: Int? = nil - @inlinable public init(key: [RedisKey], limit: Int? = nil) { + @inlinable public init(key: [RESPKey], limit: Int? = nil) { self.key = key self.limit = limit } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ZINTERCARD", RESPArrayWithCount(key), RESPWithToken("LIMIT", limit)) } } /// Stores the intersect of multiple sorted sets in a key. -public struct ZINTERSTORE: RedisCommand { +public struct ZINTERSTORE: RESPCommand { public enum Aggregate: RESPRenderable { case sum case min case max @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .sum: "SUM".encode(into: &commandEncoder) case .min: "MIN".encode(into: &commandEncoder) @@ -308,50 +307,50 @@ public struct ZINTERSTORE: RedisCommand { } public typealias Response = Int - public var destination: RedisKey - public var key: [RedisKey] + public var destination: RESPKey + public var key: [RESPKey] public var weight: [Int] = [] public var aggregate: Aggregate? = nil - @inlinable public init(destination: RedisKey, key: [RedisKey], weight: [Int] = [], aggregate: Aggregate? = nil) { + @inlinable public init(destination: RESPKey, key: [RESPKey], weight: [Int] = [], aggregate: Aggregate? = nil) { self.destination = destination self.key = key self.weight = weight self.aggregate = aggregate } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ZINTERSTORE", destination, RESPArrayWithCount(key), RESPWithToken("WEIGHTS", weight), RESPWithToken("AGGREGATE", aggregate)) } } /// Returns the number of members in a sorted set within a lexicographical range. -public struct ZLEXCOUNT: RedisCommand { +public struct ZLEXCOUNT: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var min: String public var max: String - @inlinable public init(key: RedisKey, min: String, max: String) { + @inlinable public init(key: RESPKey, min: String, max: String) { self.key = key self.min = min self.max = max } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ZLEXCOUNT", key, min, max) } } /// Returns the highest- or lowest-scoring members from one or more sorted sets after removing them. Deletes the sorted set if the last member was popped. -public struct ZMPOP: RedisCommand { +public struct ZMPOP: RESPCommand { public enum Where: RESPRenderable { case min case max @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .min: "MIN".encode(into: &commandEncoder) case .max: "MAX".encode(into: &commandEncoder) @@ -360,80 +359,80 @@ public struct ZMPOP: RedisCommand { } public typealias Response = [RESPToken]? - public var key: [RedisKey] + public var key: [RESPKey] public var `where`: Where public var count: Int? = nil - @inlinable public init(key: [RedisKey], `where`: Where, count: Int? = nil) { + @inlinable public init(key: [RESPKey], `where`: Where, count: Int? = nil) { self.key = key self.`where` = `where` self.count = count } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ZMPOP", RESPArrayWithCount(key), `where`, RESPWithToken("COUNT", count)) } } /// Returns the score of one or more members in a sorted set. -public struct ZMSCORE: RedisCommand { +public struct ZMSCORE: RESPCommand { public typealias Response = [RESPToken]? - public var key: RedisKey + public var key: RESPKey public var member: [String] - @inlinable public init(key: RedisKey, member: [String]) { + @inlinable public init(key: RESPKey, member: [String]) { self.key = key self.member = member } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ZMSCORE", key, member) } } /// Returns the highest-scoring members from a sorted set after removing them. Deletes the sorted set if the last member was popped. -public struct ZPOPMAX: RedisCommand { +public struct ZPOPMAX: RESPCommand { public typealias Response = [RESPToken] - public var key: RedisKey + public var key: RESPKey public var count: Int? = nil - @inlinable public init(key: RedisKey, count: Int? = nil) { + @inlinable public init(key: RESPKey, count: Int? = nil) { self.key = key self.count = count } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ZPOPMAX", key, count) } } /// Returns the lowest-scoring members from a sorted set after removing them. Deletes the sorted set if the last member was popped. -public struct ZPOPMIN: RedisCommand { +public struct ZPOPMIN: RESPCommand { public typealias Response = [RESPToken] - public var key: RedisKey + public var key: RESPKey public var count: Int? = nil - @inlinable public init(key: RedisKey, count: Int? = nil) { + @inlinable public init(key: RESPKey, count: Int? = nil) { self.key = key self.count = count } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ZPOPMIN", key, count) } } /// Returns one or more random members from a sorted set. -public struct ZRANDMEMBER: RedisCommand { +public struct ZRANDMEMBER: RESPCommand { public struct Options: RESPRenderable { @usableFromInline let count: Int @usableFromInline let withscores: Bool @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += count.encode(into: &commandEncoder) if self.withscores { count += "WITHSCORES".encode(into: &commandEncoder) } @@ -442,27 +441,27 @@ public struct ZRANDMEMBER: RedisCommand { } public typealias Response = RESPToken - public var key: RedisKey + public var key: RESPKey public var options: Options? = nil - @inlinable public init(key: RedisKey, options: Options? = nil) { + @inlinable public init(key: RESPKey, options: Options? = nil) { self.key = key self.options = options } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ZRANDMEMBER", key, options) } } /// Returns members in a sorted set within a range of indexes. -public struct ZRANGE: RedisCommand { +public struct ZRANGE: RESPCommand { public enum Sortby: RESPRenderable { case byscore case bylex @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .byscore: "BYSCORE".encode(into: &commandEncoder) case .bylex: "BYLEX".encode(into: &commandEncoder) @@ -474,7 +473,7 @@ public struct ZRANGE: RedisCommand { @usableFromInline let count: Int @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += offset.encode(into: &commandEncoder) count += count.encode(into: &commandEncoder) @@ -483,7 +482,7 @@ public struct ZRANGE: RedisCommand { } public typealias Response = [RESPToken] - public var key: RedisKey + public var key: RESPKey public var start: String public var stop: String public var sortby: Sortby? = nil @@ -491,7 +490,7 @@ public struct ZRANGE: RedisCommand { public var limit: Limit? = nil public var withscores: Bool = false - @inlinable public init(key: RedisKey, start: String, stop: String, sortby: Sortby? = nil, rev: Bool = false, limit: Limit? = nil, withscores: Bool = false) { + @inlinable public init(key: RESPKey, start: String, stop: String, sortby: Sortby? = nil, rev: Bool = false, limit: Limit? = nil, withscores: Bool = false) { self.key = key self.start = start self.stop = stop @@ -501,19 +500,19 @@ public struct ZRANGE: RedisCommand { self.withscores = withscores } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("ZRANGE", key, start, stop, sortby, RedisPureToken("REV", rev), RESPWithToken("LIMIT", limit), RedisPureToken("WITHSCORES", withscores)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("ZRANGE", key, start, stop, sortby, RESPPureToken("REV", rev), RESPWithToken("LIMIT", limit), RESPPureToken("WITHSCORES", withscores)) } } /// Returns members in a sorted set within a lexicographical range. -public struct ZRANGEBYLEX: RedisCommand { +public struct ZRANGEBYLEX: RESPCommand { public struct Limit: RESPRenderable { @usableFromInline let offset: Int @usableFromInline let count: Int @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += offset.encode(into: &commandEncoder) count += count.encode(into: &commandEncoder) @@ -522,31 +521,31 @@ public struct ZRANGEBYLEX: RedisCommand { } public typealias Response = [RESPToken] - public var key: RedisKey + public var key: RESPKey public var min: String public var max: String public var limit: Limit? = nil - @inlinable public init(key: RedisKey, min: String, max: String, limit: Limit? = nil) { + @inlinable public init(key: RESPKey, min: String, max: String, limit: Limit? = nil) { self.key = key self.min = min self.max = max self.limit = limit } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ZRANGEBYLEX", key, min, max, RESPWithToken("LIMIT", limit)) } } /// Returns members in a sorted set within a range of scores. -public struct ZRANGEBYSCORE: RedisCommand { +public struct ZRANGEBYSCORE: RESPCommand { public struct Limit: RESPRenderable { @usableFromInline let offset: Int @usableFromInline let count: Int @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += offset.encode(into: &commandEncoder) count += count.encode(into: &commandEncoder) @@ -555,13 +554,13 @@ public struct ZRANGEBYSCORE: RedisCommand { } public typealias Response = [RESPToken] - public var key: RedisKey + public var key: RESPKey public var min: Double public var max: Double public var withscores: Bool = false public var limit: Limit? = nil - @inlinable public init(key: RedisKey, min: Double, max: Double, withscores: Bool = false, limit: Limit? = nil) { + @inlinable public init(key: RESPKey, min: Double, max: Double, withscores: Bool = false, limit: Limit? = nil) { self.key = key self.min = min self.max = max @@ -569,19 +568,19 @@ public struct ZRANGEBYSCORE: RedisCommand { self.limit = limit } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("ZRANGEBYSCORE", key, min, max, RedisPureToken("WITHSCORES", withscores), RESPWithToken("LIMIT", limit)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("ZRANGEBYSCORE", key, min, max, RESPPureToken("WITHSCORES", withscores), RESPWithToken("LIMIT", limit)) } } /// Stores a range of members from sorted set in a key. -public struct ZRANGESTORE: RedisCommand { +public struct ZRANGESTORE: RESPCommand { public enum Sortby: RESPRenderable { case byscore case bylex @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .byscore: "BYSCORE".encode(into: &commandEncoder) case .bylex: "BYLEX".encode(into: &commandEncoder) @@ -593,7 +592,7 @@ public struct ZRANGESTORE: RedisCommand { @usableFromInline let count: Int @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += offset.encode(into: &commandEncoder) count += count.encode(into: &commandEncoder) @@ -602,15 +601,15 @@ public struct ZRANGESTORE: RedisCommand { } public typealias Response = Int - public var dst: RedisKey - public var src: RedisKey + public var dst: RESPKey + public var src: RESPKey public var min: String public var max: String public var sortby: Sortby? = nil public var rev: Bool = false public var limit: Limit? = nil - @inlinable public init(dst: RedisKey, src: RedisKey, min: String, max: String, sortby: Sortby? = nil, rev: Bool = false, limit: Limit? = nil) { + @inlinable public init(dst: RESPKey, src: RESPKey, min: String, max: String, sortby: Sortby? = nil, rev: Bool = false, limit: Limit? = nil) { self.dst = dst self.src = src self.min = min @@ -620,133 +619,133 @@ public struct ZRANGESTORE: RedisCommand { self.limit = limit } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("ZRANGESTORE", dst, src, min, max, sortby, RedisPureToken("REV", rev), RESPWithToken("LIMIT", limit)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("ZRANGESTORE", dst, src, min, max, sortby, RESPPureToken("REV", rev), RESPWithToken("LIMIT", limit)) } } /// Returns the index of a member in a sorted set ordered by ascending scores. -public struct ZRANK: RedisCommand { +public struct ZRANK: RESPCommand { public typealias Response = RESPToken - public var key: RedisKey + public var key: RESPKey public var member: String public var withscore: Bool = false - @inlinable public init(key: RedisKey, member: String, withscore: Bool = false) { + @inlinable public init(key: RESPKey, member: String, withscore: Bool = false) { self.key = key self.member = member self.withscore = withscore } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("ZRANK", key, member, RedisPureToken("WITHSCORE", withscore)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("ZRANK", key, member, RESPPureToken("WITHSCORE", withscore)) } } /// Removes one or more members from a sorted set. Deletes the sorted set if all members were removed. -public struct ZREM: RedisCommand { +public struct ZREM: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var member: [String] - @inlinable public init(key: RedisKey, member: [String]) { + @inlinable public init(key: RESPKey, member: [String]) { self.key = key self.member = member } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ZREM", key, member) } } /// Removes members in a sorted set within a lexicographical range. Deletes the sorted set if all members were removed. -public struct ZREMRANGEBYLEX: RedisCommand { +public struct ZREMRANGEBYLEX: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var min: String public var max: String - @inlinable public init(key: RedisKey, min: String, max: String) { + @inlinable public init(key: RESPKey, min: String, max: String) { self.key = key self.min = min self.max = max } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ZREMRANGEBYLEX", key, min, max) } } /// Removes members in a sorted set within a range of indexes. Deletes the sorted set if all members were removed. -public struct ZREMRANGEBYRANK: RedisCommand { +public struct ZREMRANGEBYRANK: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var start: Int public var stop: Int - @inlinable public init(key: RedisKey, start: Int, stop: Int) { + @inlinable public init(key: RESPKey, start: Int, stop: Int) { self.key = key self.start = start self.stop = stop } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ZREMRANGEBYRANK", key, start, stop) } } /// Removes members in a sorted set within a range of scores. Deletes the sorted set if all members were removed. -public struct ZREMRANGEBYSCORE: RedisCommand { +public struct ZREMRANGEBYSCORE: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var min: Double public var max: Double - @inlinable public init(key: RedisKey, min: Double, max: Double) { + @inlinable public init(key: RESPKey, min: Double, max: Double) { self.key = key self.min = min self.max = max } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ZREMRANGEBYSCORE", key, min, max) } } /// Returns members in a sorted set within a range of indexes in reverse order. -public struct ZREVRANGE: RedisCommand { +public struct ZREVRANGE: RESPCommand { public typealias Response = [RESPToken] - public var key: RedisKey + public var key: RESPKey public var start: Int public var stop: Int public var withscores: Bool = false - @inlinable public init(key: RedisKey, start: Int, stop: Int, withscores: Bool = false) { + @inlinable public init(key: RESPKey, start: Int, stop: Int, withscores: Bool = false) { self.key = key self.start = start self.stop = stop self.withscores = withscores } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("ZREVRANGE", key, start, stop, RedisPureToken("WITHSCORES", withscores)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("ZREVRANGE", key, start, stop, RESPPureToken("WITHSCORES", withscores)) } } /// Returns members in a sorted set within a lexicographical range in reverse order. -public struct ZREVRANGEBYLEX: RedisCommand { +public struct ZREVRANGEBYLEX: RESPCommand { public struct Limit: RESPRenderable { @usableFromInline let offset: Int @usableFromInline let count: Int @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += offset.encode(into: &commandEncoder) count += count.encode(into: &commandEncoder) @@ -755,31 +754,31 @@ public struct ZREVRANGEBYLEX: RedisCommand { } public typealias Response = [RESPToken] - public var key: RedisKey + public var key: RESPKey public var max: String public var min: String public var limit: Limit? = nil - @inlinable public init(key: RedisKey, max: String, min: String, limit: Limit? = nil) { + @inlinable public init(key: RESPKey, max: String, min: String, limit: Limit? = nil) { self.key = key self.max = max self.min = min self.limit = limit } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ZREVRANGEBYLEX", key, max, min, RESPWithToken("LIMIT", limit)) } } /// Returns members in a sorted set within a range of scores in reverse order. -public struct ZREVRANGEBYSCORE: RedisCommand { +public struct ZREVRANGEBYSCORE: RESPCommand { public struct Limit: RESPRenderable { @usableFromInline let offset: Int @usableFromInline let count: Int @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += offset.encode(into: &commandEncoder) count += count.encode(into: &commandEncoder) @@ -788,13 +787,13 @@ public struct ZREVRANGEBYSCORE: RedisCommand { } public typealias Response = [RESPToken] - public var key: RedisKey + public var key: RESPKey public var max: Double public var min: Double public var withscores: Bool = false public var limit: Limit? = nil - @inlinable public init(key: RedisKey, max: Double, min: Double, withscores: Bool = false, limit: Limit? = nil) { + @inlinable public init(key: RESPKey, max: Double, min: Double, withscores: Bool = false, limit: Limit? = nil) { self.key = key self.max = max self.min = min @@ -802,77 +801,77 @@ public struct ZREVRANGEBYSCORE: RedisCommand { self.limit = limit } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("ZREVRANGEBYSCORE", key, max, min, RedisPureToken("WITHSCORES", withscores), RESPWithToken("LIMIT", limit)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("ZREVRANGEBYSCORE", key, max, min, RESPPureToken("WITHSCORES", withscores), RESPWithToken("LIMIT", limit)) } } /// Returns the index of a member in a sorted set ordered by descending scores. -public struct ZREVRANK: RedisCommand { +public struct ZREVRANK: RESPCommand { public typealias Response = RESPToken - public var key: RedisKey + public var key: RESPKey public var member: String public var withscore: Bool = false - @inlinable public init(key: RedisKey, member: String, withscore: Bool = false) { + @inlinable public init(key: RESPKey, member: String, withscore: Bool = false) { self.key = key self.member = member self.withscore = withscore } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("ZREVRANK", key, member, RedisPureToken("WITHSCORE", withscore)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("ZREVRANK", key, member, RESPPureToken("WITHSCORE", withscore)) } } /// Iterates over members and scores of a sorted set. -public struct ZSCAN: RedisCommand { +public struct ZSCAN: RESPCommand { public typealias Response = [RESPToken] - public var key: RedisKey + public var key: RESPKey public var cursor: Int public var pattern: String? = nil public var count: Int? = nil - @inlinable public init(key: RedisKey, cursor: Int, pattern: String? = nil, count: Int? = nil) { + @inlinable public init(key: RESPKey, cursor: Int, pattern: String? = nil, count: Int? = nil) { self.key = key self.cursor = cursor self.pattern = pattern self.count = count } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ZSCAN", key, cursor, RESPWithToken("MATCH", pattern), RESPWithToken("COUNT", count)) } } /// Returns the score of a member in a sorted set. -public struct ZSCORE: RedisCommand { +public struct ZSCORE: RESPCommand { public typealias Response = Double? - public var key: RedisKey + public var key: RESPKey public var member: String - @inlinable public init(key: RedisKey, member: String) { + @inlinable public init(key: RESPKey, member: String) { self.key = key self.member = member } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ZSCORE", key, member) } } /// Returns the union of multiple sorted sets. -public struct ZUNION: RedisCommand { +public struct ZUNION: RESPCommand { public enum Aggregate: RESPRenderable { case sum case min case max @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .sum: "SUM".encode(into: &commandEncoder) case .min: "MIN".encode(into: &commandEncoder) @@ -882,32 +881,32 @@ public struct ZUNION: RedisCommand { } public typealias Response = [RESPToken] - public var key: [RedisKey] + public var key: [RESPKey] public var weight: [Int] = [] public var aggregate: Aggregate? = nil public var withscores: Bool = false - @inlinable public init(key: [RedisKey], weight: [Int] = [], aggregate: Aggregate? = nil, withscores: Bool = false) { + @inlinable public init(key: [RESPKey], weight: [Int] = [], aggregate: Aggregate? = nil, withscores: Bool = false) { self.key = key self.weight = weight self.aggregate = aggregate self.withscores = withscores } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("ZUNION", RESPArrayWithCount(key), RESPWithToken("WEIGHTS", weight), RESPWithToken("AGGREGATE", aggregate), RedisPureToken("WITHSCORES", withscores)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("ZUNION", RESPArrayWithCount(key), RESPWithToken("WEIGHTS", weight), RESPWithToken("AGGREGATE", aggregate), RESPPureToken("WITHSCORES", withscores)) } } /// Stores the union of multiple sorted sets in a key. -public struct ZUNIONSTORE: RedisCommand { +public struct ZUNIONSTORE: RESPCommand { public enum Aggregate: RESPRenderable { case sum case min case max @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .sum: "SUM".encode(into: &commandEncoder) case .min: "MIN".encode(into: &commandEncoder) @@ -917,465 +916,467 @@ public struct ZUNIONSTORE: RedisCommand { } public typealias Response = Int - public var destination: RedisKey - public var key: [RedisKey] + public var destination: RESPKey + public var key: [RESPKey] public var weight: [Int] = [] public var aggregate: Aggregate? = nil - @inlinable public init(destination: RedisKey, key: [RedisKey], weight: [Int] = [], aggregate: Aggregate? = nil) { + @inlinable public init(destination: RESPKey, key: [RESPKey], weight: [Int] = [], aggregate: Aggregate? = nil) { self.destination = destination self.key = key self.weight = weight self.aggregate = aggregate } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("ZUNIONSTORE", destination, RESPArrayWithCount(key), RESPWithToken("WEIGHTS", weight), RESPWithToken("AGGREGATE", aggregate)) } } -extension RedisConnection { +extension ValkeyConnection { /// Removes and returns a member by score from one or more sorted sets. Blocks until a member is available otherwise. Deletes the sorted set if the last element was popped. /// - /// - Documentation: [BZMPOP](https:/redis.io/docs/latest/commands/bzmpop) + /// - Documentation: [BZMPOP](https:/valkey.io/commands/bzmpop) /// - Version: 7.0.0 /// - Complexity: O(K) + O(M*log(N)) where K is the number of provided keys, N being the number of elements in the sorted set, and M being the number of elements popped. /// - Categories: @write, @sortedset, @slow, @blocking /// - Returns: One of the following: - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): when no element could be popped. - /// * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a two-element array with the first element being the name of the key from which elements were popped, and the second element is an array of the popped elements. Every entry in the elements array is also an array that contains the member and its score. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): when no element could be popped. + /// * [Array](https:/valkey.io/topics/protocol/#arrays): a two-element array with the first element being the name of the key from which elements were popped, and the second element is an array of the popped elements. Every entry in the elements array is also an array that contains the member and its score. @inlinable - public func bzmpop(timeout: Double, key: [RedisKey], `where`: BZMPOP.Where, count: Int? = nil) async throws -> [RESPToken]? { + public func bzmpop(timeout: Double, key: [RESPKey], `where`: BZMPOP.Where, count: Int? = nil) async throws -> [RESPToken]? { try await send(command: BZMPOP(timeout: timeout, key: key, where: `where`, count: count)) } /// Removes and returns the member with the highest score from one or more sorted sets. Blocks until a member available otherwise. Deletes the sorted set if the last element was popped. /// - /// - Documentation: [BZPOPMAX](https:/redis.io/docs/latest/commands/bzpopmax) + /// - Documentation: [BZPOPMAX](https:/valkey.io/commands/bzpopmax) /// - Version: 5.0.0 /// - Complexity: O(log(N)) with N being the number of elements in the sorted set. /// - Categories: @write, @sortedset, @fast, @blocking /// - Returns: One of the following: - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): when no element could be popped and the _timeout_ expired. - /// * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): the keyname, popped member, and its score. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): when no element could be popped and the _timeout_ expired. + /// * [Array](https:/valkey.io/topics/protocol/#arrays): the keyname, popped member, and its score. @inlinable - public func bzpopmax(key: [RedisKey], timeout: Double) async throws -> [RESPToken]? { + public func bzpopmax(key: [RESPKey], timeout: Double) async throws -> [RESPToken]? { try await send(command: BZPOPMAX(key: key, timeout: timeout)) } /// Removes and returns the member with the lowest score from one or more sorted sets. Blocks until a member is available otherwise. Deletes the sorted set if the last element was popped. /// - /// - Documentation: [BZPOPMIN](https:/redis.io/docs/latest/commands/bzpopmin) + /// - Documentation: [BZPOPMIN](https:/valkey.io/commands/bzpopmin) /// - Version: 5.0.0 /// - Complexity: O(log(N)) with N being the number of elements in the sorted set. /// - Categories: @write, @sortedset, @fast, @blocking /// - Returns: One of the following: - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): when no element could be popped and the _timeout_ expired. - /// * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): the keyname, popped member, and its score. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): when no element could be popped and the _timeout_ expired. + /// * [Array](https:/valkey.io/topics/protocol/#arrays): the keyname, popped member, and its score. @inlinable - public func bzpopmin(key: [RedisKey], timeout: Double) async throws -> [RESPToken]? { + public func bzpopmin(key: [RESPKey], timeout: Double) async throws -> [RESPToken]? { try await send(command: BZPOPMIN(key: key, timeout: timeout)) } /// Adds one or more members to a sorted set, or updates their scores. Creates the key if it doesn't exist. /// - /// - Documentation: [ZADD](https:/redis.io/docs/latest/commands/zadd) + /// - Documentation: [ZADD](https:/valkey.io/commands/zadd) /// - Version: 1.2.0 /// - Complexity: O(log(N)) for each item added, where N is the number of elements in the sorted set. /// - Categories: @write, @sortedset, @fast /// - Returns: Any of the following: - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): if the operation was aborted because of a conflict with one of the _XX/NX/LT/GT_ options. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of new members when the _CH_ option is not used. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of new or updated members when the _CH_ option is used. - /// * [Double](https:/redis.io/docs/reference/protocol-spec#doubles): the updated score of the member when the _INCR_ option is used. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): if the operation was aborted because of a conflict with one of the _XX/NX/LT/GT_ options. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): the number of new members when the _CH_ option is not used. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): the number of new or updated members when the _CH_ option is used. + /// * [Double](https:/valkey.io/topics/protocol/#doubles): the updated score of the member when the _INCR_ option is used. @inlinable - public func zadd(key: RedisKey, condition: ZADD.Condition? = nil, comparison: ZADD.Comparison? = nil, change: Bool = false, increment: Bool = false, data: [ZADD.Data]) async throws -> RESPToken { + public func zadd(key: RESPKey, condition: ZADD.Condition? = nil, comparison: ZADD.Comparison? = nil, change: Bool = false, increment: Bool = false, data: [ZADD.Data]) async throws -> RESPToken { try await send(command: ZADD(key: key, condition: condition, comparison: comparison, change: change, increment: increment, data: data)) } /// Returns the number of members in a sorted set. /// - /// - Documentation: [ZCARD](https:/redis.io/docs/latest/commands/zcard) + /// - Documentation: [ZCARD](https:/valkey.io/commands/zcard) /// - Version: 1.2.0 /// - Complexity: O(1) /// - Categories: @read, @sortedset, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the cardinality (number of members) of the sorted set, or 0 if the key doesn't exist. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the cardinality (number of members) of the sorted set, or 0 if the key doesn't exist. @inlinable - public func zcard(key: RedisKey) async throws -> Int { + public func zcard(key: RESPKey) async throws -> Int { try await send(command: ZCARD(key: key)) } /// Returns the count of members in a sorted set that have scores within a range. /// - /// - Documentation: [ZCOUNT](https:/redis.io/docs/latest/commands/zcount) + /// - Documentation: [ZCOUNT](https:/valkey.io/commands/zcount) /// - Version: 2.0.0 /// - Complexity: O(log(N)) with N being the number of elements in the sorted set. /// - Categories: @read, @sortedset, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of members in the specified score range. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of members in the specified score range. @inlinable - public func zcount(key: RedisKey, min: Double, max: Double) async throws -> Int { + public func zcount(key: RESPKey, min: Double, max: Double) async throws -> Int { try await send(command: ZCOUNT(key: key, min: min, max: max)) } /// Returns the difference between multiple sorted sets. /// - /// - Documentation: [ZDIFF](https:/redis.io/docs/latest/commands/zdiff) + /// - Documentation: [ZDIFF](https:/valkey.io/commands/zdiff) /// - Version: 6.2.0 /// - Complexity: O(L + (N-K)log(N)) worst case where L is the total number of elements in all the sets, N is the size of the first set, and K is the size of the result set. /// - Categories: @read, @sortedset, @slow - /// - Returns: * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): the result of the difference including, optionally, scores when the _WITHSCORES_ option is used. + /// - Returns: * [Array](https:/valkey.io/topics/protocol/#arrays): the result of the difference including, optionally, scores when the _WITHSCORES_ option is used. @inlinable - public func zdiff(key: [RedisKey], withscores: Bool = false) async throws -> [RESPToken] { + public func zdiff(key: [RESPKey], withscores: Bool = false) async throws -> [RESPToken] { try await send(command: ZDIFF(key: key, withscores: withscores)) } /// Stores the difference of multiple sorted sets in a key. /// - /// - Documentation: [ZDIFFSTORE](https:/redis.io/docs/latest/commands/zdiffstore) + /// - Documentation: [ZDIFFSTORE](https:/valkey.io/commands/zdiffstore) /// - Version: 6.2.0 /// - Complexity: O(L + (N-K)log(N)) worst case where L is the total number of elements in all the sets, N is the size of the first set, and K is the size of the result set. /// - Categories: @write, @sortedset, @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of members in the resulting sorted set at _destination_. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of members in the resulting sorted set at _destination_. @inlinable - public func zdiffstore(destination: RedisKey, key: [RedisKey]) async throws -> Int { + public func zdiffstore(destination: RESPKey, key: [RESPKey]) async throws -> Int { try await send(command: ZDIFFSTORE(destination: destination, key: key)) } /// Increments the score of a member in a sorted set. /// - /// - Documentation: [ZINCRBY](https:/redis.io/docs/latest/commands/zincrby) + /// - Documentation: [ZINCRBY](https:/valkey.io/commands/zincrby) /// - Version: 1.2.0 /// - Complexity: O(log(N)) where N is the number of elements in the sorted set. /// - Categories: @write, @sortedset, @fast - /// - Returns: [Double](https:/redis.io/docs/reference/protocol-spec#doubles): the new score of _member_. + /// - Returns: [Double](https:/valkey.io/topics/protocol/#doubles): the new score of _member_. @inlinable - public func zincrby(key: RedisKey, increment: Int, member: String) async throws -> Double { + public func zincrby(key: RESPKey, increment: Int, member: String) async throws -> Double { try await send(command: ZINCRBY(key: key, increment: increment, member: member)) } /// Returns the intersect of multiple sorted sets. /// - /// - Documentation: [ZINTER](https:/redis.io/docs/latest/commands/zinter) + /// - Documentation: [ZINTER](https:/valkey.io/commands/zinter) /// - Version: 6.2.0 /// - Complexity: O(N*K)+O(M*log(M)) worst case with N being the smallest input sorted set, K being the number of input sorted sets and M being the number of elements in the resulting sorted set. /// - Categories: @read, @sortedset, @slow - /// - Returns: * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): the result of the intersection including, optionally, scores when the _WITHSCORES_ option is used. + /// - Returns: * [Array](https:/valkey.io/topics/protocol/#arrays): the result of the intersection including, optionally, scores when the _WITHSCORES_ option is used. @inlinable - public func zinter(key: [RedisKey], weight: [Int] = [], aggregate: ZINTER.Aggregate? = nil, withscores: Bool = false) async throws -> [RESPToken] { + public func zinter(key: [RESPKey], weight: [Int] = [], aggregate: ZINTER.Aggregate? = nil, withscores: Bool = false) async throws -> [RESPToken] { try await send(command: ZINTER(key: key, weight: weight, aggregate: aggregate, withscores: withscores)) } /// Returns the number of members of the intersect of multiple sorted sets. /// - /// - Documentation: [ZINTERCARD](https:/redis.io/docs/latest/commands/zintercard) + /// - Documentation: [ZINTERCARD](https:/valkey.io/commands/zintercard) /// - Version: 7.0.0 /// - Complexity: O(N*K) worst case with N being the smallest input sorted set, K being the number of input sorted sets. /// - Categories: @read, @sortedset, @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of members in the resulting intersection. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of members in the resulting intersection. @inlinable - public func zintercard(key: [RedisKey], limit: Int? = nil) async throws -> Int { + public func zintercard(key: [RESPKey], limit: Int? = nil) async throws -> Int { try await send(command: ZINTERCARD(key: key, limit: limit)) } /// Stores the intersect of multiple sorted sets in a key. /// - /// - Documentation: [ZINTERSTORE](https:/redis.io/docs/latest/commands/zinterstore) + /// - Documentation: [ZINTERSTORE](https:/valkey.io/commands/zinterstore) /// - Version: 2.0.0 /// - Complexity: O(N*K)+O(M*log(M)) worst case with N being the smallest input sorted set, K being the number of input sorted sets and M being the number of elements in the resulting sorted set. /// - Categories: @write, @sortedset, @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of members in the resulting sorted set at the _destination_. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of members in the resulting sorted set at the _destination_. @inlinable - public func zinterstore(destination: RedisKey, key: [RedisKey], weight: [Int] = [], aggregate: ZINTERSTORE.Aggregate? = nil) async throws -> Int { + public func zinterstore(destination: RESPKey, key: [RESPKey], weight: [Int] = [], aggregate: ZINTERSTORE.Aggregate? = nil) async throws -> Int { try await send(command: ZINTERSTORE(destination: destination, key: key, weight: weight, aggregate: aggregate)) } /// Returns the number of members in a sorted set within a lexicographical range. /// - /// - Documentation: [ZLEXCOUNT](https:/redis.io/docs/latest/commands/zlexcount) + /// - Documentation: [ZLEXCOUNT](https:/valkey.io/commands/zlexcount) /// - Version: 2.8.9 /// - Complexity: O(log(N)) with N being the number of elements in the sorted set. /// - Categories: @read, @sortedset, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of members in the specified score range. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of members in the specified score range. @inlinable - public func zlexcount(key: RedisKey, min: String, max: String) async throws -> Int { + public func zlexcount(key: RESPKey, min: String, max: String) async throws -> Int { try await send(command: ZLEXCOUNT(key: key, min: min, max: max)) } /// Returns the highest- or lowest-scoring members from one or more sorted sets after removing them. Deletes the sorted set if the last member was popped. /// - /// - Documentation: [ZMPOP](https:/redis.io/docs/latest/commands/zmpop) + /// - Documentation: [ZMPOP](https:/valkey.io/commands/zmpop) /// - Version: 7.0.0 /// - Complexity: O(K) + O(M*log(N)) where K is the number of provided keys, N being the number of elements in the sorted set, and M being the number of elements popped. /// - Categories: @write, @sortedset, @slow /// - Returns: One of the following: - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): when no element could be popped. - /// * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): A two-element array with the first element being the name of the key from which elements were popped, and the second element is an array of the popped elements. Every entry in the elements array is also an array that contains the member and its score. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): when no element could be popped. + /// * [Array](https:/valkey.io/topics/protocol/#arrays): A two-element array with the first element being the name of the key from which elements were popped, and the second element is an array of the popped elements. Every entry in the elements array is also an array that contains the member and its score. @inlinable - public func zmpop(key: [RedisKey], `where`: ZMPOP.Where, count: Int? = nil) async throws -> [RESPToken]? { + public func zmpop(key: [RESPKey], `where`: ZMPOP.Where, count: Int? = nil) async throws -> [RESPToken]? { try await send(command: ZMPOP(key: key, where: `where`, count: count)) } /// Returns the score of one or more members in a sorted set. /// - /// - Documentation: [ZMSCORE](https:/redis.io/docs/latest/commands/zmscore) + /// - Documentation: [ZMSCORE](https:/valkey.io/commands/zmscore) /// - Version: 6.2.0 /// - Complexity: O(N) where N is the number of members being requested. /// - Categories: @read, @sortedset, @fast /// - Returns: One of the following: - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): if the member does not exist in the sorted set. - /// * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of [Double](https:/redis.io/docs/reference/protocol-spec#doubles) _member_ scores as double-precision floating point numbers. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): if the member does not exist in the sorted set. + /// * [Array](https:/valkey.io/topics/protocol/#arrays): a list of [Double](https:/valkey.io/topics/protocol/#doubles) _member_ scores as double-precision floating point numbers. @inlinable - public func zmscore(key: RedisKey, member: [String]) async throws -> [RESPToken]? { + public func zmscore(key: RESPKey, member: [String]) async throws -> [RESPToken]? { try await send(command: ZMSCORE(key: key, member: member)) } /// Returns the highest-scoring members from a sorted set after removing them. Deletes the sorted set if the last member was popped. /// - /// - Documentation: [ZPOPMAX](https:/redis.io/docs/latest/commands/zpopmax) + /// - Documentation: [ZPOPMAX](https:/valkey.io/commands/zpopmax) /// - Version: 5.0.0 /// - Complexity: O(log(N)*M) with N being the number of elements in the sorted set, and M being the number of elements popped. /// - Categories: @write, @sortedset, @fast - /// - Returns: * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of popped elements and scores. + /// - Returns: * [Array](https:/valkey.io/topics/protocol/#arrays): a list of popped elements and scores. @inlinable - public func zpopmax(key: RedisKey, count: Int? = nil) async throws -> [RESPToken] { + public func zpopmax(key: RESPKey, count: Int? = nil) async throws -> [RESPToken] { try await send(command: ZPOPMAX(key: key, count: count)) } /// Returns the lowest-scoring members from a sorted set after removing them. Deletes the sorted set if the last member was popped. /// - /// - Documentation: [ZPOPMIN](https:/redis.io/docs/latest/commands/zpopmin) + /// - Documentation: [ZPOPMIN](https:/valkey.io/commands/zpopmin) /// - Version: 5.0.0 /// - Complexity: O(log(N)*M) with N being the number of elements in the sorted set, and M being the number of elements popped. /// - Categories: @write, @sortedset, @fast - /// - Returns: * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of popped elements and scores. + /// - Returns: * [Array](https:/valkey.io/topics/protocol/#arrays): a list of popped elements and scores. @inlinable - public func zpopmin(key: RedisKey, count: Int? = nil) async throws -> [RESPToken] { + public func zpopmin(key: RESPKey, count: Int? = nil) async throws -> [RESPToken] { try await send(command: ZPOPMIN(key: key, count: count)) } /// Returns one or more random members from a sorted set. /// - /// - Documentation: [ZRANDMEMBER](https:/redis.io/docs/latest/commands/zrandmember) + /// - Documentation: [ZRANDMEMBER](https:/valkey.io/commands/zrandmember) /// - Version: 6.2.0 /// - Complexity: O(N) where N is the number of members returned /// - Categories: @read, @sortedset, @slow - /// - Returns: [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): without the additional _count_ argument, the command returns a randomly selected member, or [Null](https:/redis.io/docs/reference/protocol-spec#nulls) when _key_ doesn't exist. - /// [Array](https:/redis.io/docs/reference/protocol-spec#arrays): when the additional _count_ argument is passed, the command returns an array of members, or an empty array when _key_ doesn't exist. If the _WITHSCORES_ modifier is used, the reply is a list of members and their scores from the sorted set. + /// - Returns: [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): without the additional _count_ argument, the command returns a randomly selected member, or [Null](https:/valkey.io/topics/protocol/#nulls) when _key_ doesn't exist. + /// [Array](https:/valkey.io/topics/protocol/#arrays): when the additional _count_ argument is passed, the command returns an array of members, or an empty array when _key_ doesn't exist. If the _WITHSCORES_ modifier is used, the reply is a list of members and their scores from the sorted set. @inlinable - public func zrandmember(key: RedisKey, options: ZRANDMEMBER.Options? = nil) async throws -> RESPToken { + public func zrandmember(key: RESPKey, options: ZRANDMEMBER.Options? = nil) async throws -> RESPToken { try await send(command: ZRANDMEMBER(key: key, options: options)) } /// Returns members in a sorted set within a range of indexes. /// - /// - Documentation: [ZRANGE](https:/redis.io/docs/latest/commands/zrange) + /// - Documentation: [ZRANGE](https:/valkey.io/commands/zrange) /// - Version: 1.2.0 /// - Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements returned. /// - Categories: @read, @sortedset, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of members in the specified range with, optionally, their scores when the _WITHSCORES_ option is given. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of members in the specified range with, optionally, their scores when the _WITHSCORES_ option is given. @inlinable - public func zrange(key: RedisKey, start: String, stop: String, sortby: ZRANGE.Sortby? = nil, rev: Bool = false, limit: ZRANGE.Limit? = nil, withscores: Bool = false) async throws -> [RESPToken] { + public func zrange(key: RESPKey, start: String, stop: String, sortby: ZRANGE.Sortby? = nil, rev: Bool = false, limit: ZRANGE.Limit? = nil, withscores: Bool = false) async throws -> [RESPToken] { try await send(command: ZRANGE(key: key, start: start, stop: stop, sortby: sortby, rev: rev, limit: limit, withscores: withscores)) } /// Returns members in a sorted set within a lexicographical range. /// - /// - Documentation: [ZRANGEBYLEX](https:/redis.io/docs/latest/commands/zrangebylex) + /// - Documentation: [ZRANGEBYLEX](https:/valkey.io/commands/zrangebylex) /// - Version: 2.8.9 /// - Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements being returned. If M is constant (e.g. always asking for the first 10 elements with LIMIT), you can consider it O(log(N)). /// - Categories: @read, @sortedset, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of elements in the specified score range. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of elements in the specified score range. @inlinable - public func zrangebylex(key: RedisKey, min: String, max: String, limit: ZRANGEBYLEX.Limit? = nil) async throws -> [RESPToken] { + public func zrangebylex(key: RESPKey, min: String, max: String, limit: ZRANGEBYLEX.Limit? = nil) async throws -> [RESPToken] { try await send(command: ZRANGEBYLEX(key: key, min: min, max: max, limit: limit)) } /// Returns members in a sorted set within a range of scores. /// - /// - Documentation: [ZRANGEBYSCORE](https:/redis.io/docs/latest/commands/zrangebyscore) + /// - Documentation: [ZRANGEBYSCORE](https:/valkey.io/commands/zrangebyscore) /// - Version: 1.0.5 /// - Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements being returned. If M is constant (e.g. always asking for the first 10 elements with LIMIT), you can consider it O(log(N)). /// - Categories: @read, @sortedset, @slow - /// - Returns: * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of the members with, optionally, their scores in the specified score range. + /// - Returns: * [Array](https:/valkey.io/topics/protocol/#arrays): a list of the members with, optionally, their scores in the specified score range. @inlinable - public func zrangebyscore(key: RedisKey, min: Double, max: Double, withscores: Bool = false, limit: ZRANGEBYSCORE.Limit? = nil) async throws -> [RESPToken] { + public func zrangebyscore(key: RESPKey, min: Double, max: Double, withscores: Bool = false, limit: ZRANGEBYSCORE.Limit? = nil) async throws -> [RESPToken] { try await send(command: ZRANGEBYSCORE(key: key, min: min, max: max, withscores: withscores, limit: limit)) } /// Stores a range of members from sorted set in a key. /// - /// - Documentation: [ZRANGESTORE](https:/redis.io/docs/latest/commands/zrangestore) + /// - Documentation: [ZRANGESTORE](https:/valkey.io/commands/zrangestore) /// - Version: 6.2.0 /// - Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements stored into the destination key. /// - Categories: @write, @sortedset, @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of elements in the resulting sorted set. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of elements in the resulting sorted set. @inlinable - public func zrangestore(dst: RedisKey, src: RedisKey, min: String, max: String, sortby: ZRANGESTORE.Sortby? = nil, rev: Bool = false, limit: ZRANGESTORE.Limit? = nil) async throws -> Int { + public func zrangestore(dst: RESPKey, src: RESPKey, min: String, max: String, sortby: ZRANGESTORE.Sortby? = nil, rev: Bool = false, limit: ZRANGESTORE.Limit? = nil) async throws -> Int { try await send(command: ZRANGESTORE(dst: dst, src: src, min: min, max: max, sortby: sortby, rev: rev, limit: limit)) } /// Returns the index of a member in a sorted set ordered by ascending scores. /// - /// - Documentation: [ZRANK](https:/redis.io/docs/latest/commands/zrank) + /// - Documentation: [ZRANK](https:/valkey.io/commands/zrank) /// - Version: 2.0.0 /// - Complexity: O(log(N)) /// - Categories: @read, @sortedset, @fast /// - Returns: One of the following: - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): if the key does not exist or the member does not exist in the sorted set. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the rank of the member when _WITHSCORE_ is not used. - /// * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): the rank and score of the member when _WITHSCORE_ is used. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): if the key does not exist or the member does not exist in the sorted set. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): the rank of the member when _WITHSCORE_ is not used. + /// * [Array](https:/valkey.io/topics/protocol/#arrays): the rank and score of the member when _WITHSCORE_ is used. @inlinable - public func zrank(key: RedisKey, member: String, withscore: Bool = false) async throws -> RESPToken { + public func zrank(key: RESPKey, member: String, withscore: Bool = false) async throws -> RESPToken { try await send(command: ZRANK(key: key, member: member, withscore: withscore)) } /// Removes one or more members from a sorted set. Deletes the sorted set if all members were removed. /// - /// - Documentation: [ZREM](https:/redis.io/docs/latest/commands/zrem) + /// - Documentation: [ZREM](https:/valkey.io/commands/zrem) /// - Version: 1.2.0 /// - Complexity: O(M*log(N)) with N being the number of elements in the sorted set and M the number of elements to be removed. /// - Categories: @write, @sortedset, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of members removed from the sorted set, not including non-existing members. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of members removed from the sorted set, not including non-existing members. @inlinable - public func zrem(key: RedisKey, member: [String]) async throws -> Int { + public func zrem(key: RESPKey, member: [String]) async throws -> Int { try await send(command: ZREM(key: key, member: member)) } /// Removes members in a sorted set within a lexicographical range. Deletes the sorted set if all members were removed. /// - /// - Documentation: [ZREMRANGEBYLEX](https:/redis.io/docs/latest/commands/zremrangebylex) + /// - Documentation: [ZREMRANGEBYLEX](https:/valkey.io/commands/zremrangebylex) /// - Version: 2.8.9 /// - Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements removed by the operation. /// - Categories: @write, @sortedset, @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): Number of members removed. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of members removed. @inlinable - public func zremrangebylex(key: RedisKey, min: String, max: String) async throws -> Int { + public func zremrangebylex(key: RESPKey, min: String, max: String) async throws -> Int { try await send(command: ZREMRANGEBYLEX(key: key, min: min, max: max)) } /// Removes members in a sorted set within a range of indexes. Deletes the sorted set if all members were removed. /// - /// - Documentation: [ZREMRANGEBYRANK](https:/redis.io/docs/latest/commands/zremrangebyrank) + /// - Documentation: [ZREMRANGEBYRANK](https:/valkey.io/commands/zremrangebyrank) /// - Version: 2.0.0 /// - Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements removed by the operation. /// - Categories: @write, @sortedset, @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): Number of members removed. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of members removed. @inlinable - public func zremrangebyrank(key: RedisKey, start: Int, stop: Int) async throws -> Int { + public func zremrangebyrank(key: RESPKey, start: Int, stop: Int) async throws -> Int { try await send(command: ZREMRANGEBYRANK(key: key, start: start, stop: stop)) } /// Removes members in a sorted set within a range of scores. Deletes the sorted set if all members were removed. /// - /// - Documentation: [ZREMRANGEBYSCORE](https:/redis.io/docs/latest/commands/zremrangebyscore) + /// - Documentation: [ZREMRANGEBYSCORE](https:/valkey.io/commands/zremrangebyscore) /// - Version: 1.2.0 /// - Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements removed by the operation. /// - Categories: @write, @sortedset, @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): Number of members removed. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of members removed. @inlinable - public func zremrangebyscore(key: RedisKey, min: Double, max: Double) async throws -> Int { + public func zremrangebyscore(key: RESPKey, min: Double, max: Double) async throws -> Int { try await send(command: ZREMRANGEBYSCORE(key: key, min: min, max: max)) } /// Returns members in a sorted set within a range of indexes in reverse order. /// - /// - Documentation: [ZREVRANGE](https:/redis.io/docs/latest/commands/zrevrange) + /// - Documentation: [ZREVRANGE](https:/valkey.io/commands/zrevrange) /// - Version: 1.2.0 /// - Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements returned. /// - Categories: @read, @sortedset, @slow - /// - Returns: * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of members in the specified range, optionally with their scores if _WITHSCORE_ was used. + /// - Returns: * [Array](https:/valkey.io/topics/protocol/#arrays): a list of the members in the specified range, optionally with their scores if _WITHSCORE_ was used. @inlinable - public func zrevrange(key: RedisKey, start: Int, stop: Int, withscores: Bool = false) async throws -> [RESPToken] { + public func zrevrange(key: RESPKey, start: Int, stop: Int, withscores: Bool = false) async throws -> [RESPToken] { try await send(command: ZREVRANGE(key: key, start: start, stop: stop, withscores: withscores)) } /// Returns members in a sorted set within a lexicographical range in reverse order. /// - /// - Documentation: [ZREVRANGEBYLEX](https:/redis.io/docs/latest/commands/zrevrangebylex) + /// - Documentation: [ZREVRANGEBYLEX](https:/valkey.io/commands/zrevrangebylex) /// - Version: 2.8.9 /// - Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements being returned. If M is constant (e.g. always asking for the first 10 elements with LIMIT), you can consider it O(log(N)). /// - Categories: @read, @sortedset, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): List of the elements in the specified score range. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of the members in the specified score range. @inlinable - public func zrevrangebylex(key: RedisKey, max: String, min: String, limit: ZREVRANGEBYLEX.Limit? = nil) async throws -> [RESPToken] { + public func zrevrangebylex(key: RESPKey, max: String, min: String, limit: ZREVRANGEBYLEX.Limit? = nil) async throws -> [RESPToken] { try await send(command: ZREVRANGEBYLEX(key: key, max: max, min: min, limit: limit)) } /// Returns members in a sorted set within a range of scores in reverse order. /// - /// - Documentation: [ZREVRANGEBYSCORE](https:/redis.io/docs/latest/commands/zrevrangebyscore) + /// - Documentation: [ZREVRANGEBYSCORE](https:/valkey.io/commands/zrevrangebyscore) /// - Version: 2.2.0 /// - Complexity: O(log(N)+M) with N being the number of elements in the sorted set and M the number of elements being returned. If M is constant (e.g. always asking for the first 10 elements with LIMIT), you can consider it O(log(N)). /// - Categories: @read, @sortedset, @slow - /// - Returns: * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of the members and, optionally, their scores in the specified score range. + /// - Returns: * [Array](https:/valkey.io/topics/protocol/#arrays): a list of the members and, optionally, their scores in the specified score range. @inlinable - public func zrevrangebyscore(key: RedisKey, max: Double, min: Double, withscores: Bool = false, limit: ZREVRANGEBYSCORE.Limit? = nil) async throws -> [RESPToken] { + public func zrevrangebyscore(key: RESPKey, max: Double, min: Double, withscores: Bool = false, limit: ZREVRANGEBYSCORE.Limit? = nil) async throws -> [RESPToken] { try await send(command: ZREVRANGEBYSCORE(key: key, max: max, min: min, withscores: withscores, limit: limit)) } /// Returns the index of a member in a sorted set ordered by descending scores. /// - /// - Documentation: [ZREVRANK](https:/redis.io/docs/latest/commands/zrevrank) + /// - Documentation: [ZREVRANK](https:/valkey.io/commands/zrevrank) /// - Version: 2.0.0 /// - Complexity: O(log(N)) /// - Categories: @read, @sortedset, @fast /// - Returns: One of the following: - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): if the key does not exist or the member does not exist in the sorted set. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): The rank of the member when _WITHSCORE_ is not used. - /// * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): The rank and score of the member when _WITHSCORE_ is used. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): if the key does not exist or the member does not exist in the sorted set. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): The rank of the member when _WITHSCORE_ is not used. + /// * [Array](https:/valkey.io/topics/protocol/#arrays): The rank and score of the member when _WITHSCORE_ is used. @inlinable - public func zrevrank(key: RedisKey, member: String, withscore: Bool = false) async throws -> RESPToken { + public func zrevrank(key: RESPKey, member: String, withscore: Bool = false) async throws -> RESPToken { try await send(command: ZREVRANK(key: key, member: member, withscore: withscore)) } /// Iterates over members and scores of a sorted set. /// - /// - Documentation: [ZSCAN](https:/redis.io/docs/latest/commands/zscan) + /// - Documentation: [ZSCAN](https:/valkey.io/commands/zscan) /// - Version: 2.8.0 /// - Complexity: O(1) for every call. O(N) for a complete iteration, including enough command calls for the cursor to return back to 0. N is the number of elements inside the collection. /// - Categories: @read, @sortedset, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): cursor and scan response in array form. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a two-element array. + /// * The first element is a [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings) that represents an unsigned 64-bit number, the cursor. + /// * The second element is an [Array](https:/valkey.io/topics/protocol/#arrays) of member/score pairs that were scanned. When `NOSCORES` option is on, a list of members from the sorted set. @inlinable - public func zscan(key: RedisKey, cursor: Int, pattern: String? = nil, count: Int? = nil) async throws -> [RESPToken] { + public func zscan(key: RESPKey, cursor: Int, pattern: String? = nil, count: Int? = nil) async throws -> [RESPToken] { try await send(command: ZSCAN(key: key, cursor: cursor, pattern: pattern, count: count)) } /// Returns the score of a member in a sorted set. /// - /// - Documentation: [ZSCORE](https:/redis.io/docs/latest/commands/zscore) + /// - Documentation: [ZSCORE](https:/valkey.io/commands/zscore) /// - Version: 1.2.0 /// - Complexity: O(1) /// - Categories: @read, @sortedset, @fast /// - Returns: One of the following: - /// * [Double](https:/redis.io/docs/reference/protocol-spec#doubles): the score of the member (a double-precision floating point number). - /// * [Nil](https:/redis.io/docs/reference/protocol-spec#bulk-strings): if _member_ does not exist in the sorted set, or the key does not exist. + /// * [Double](https:/valkey.io/topics/protocol/#doubles): the score of the member (a double-precision floating point number). + /// * [Null](https:/valkey.io/topics/protocol/#nulls): if _member_ does not exist in the sorted set, or the key does not exist. @inlinable - public func zscore(key: RedisKey, member: String) async throws -> Double? { + public func zscore(key: RESPKey, member: String) async throws -> Double? { try await send(command: ZSCORE(key: key, member: member)) } /// Returns the union of multiple sorted sets. /// - /// - Documentation: [ZUNION](https:/redis.io/docs/latest/commands/zunion) + /// - Documentation: [ZUNION](https:/valkey.io/commands/zunion) /// - Version: 6.2.0 /// - Complexity: O(N)+O(M*log(M)) with N being the sum of the sizes of the input sorted sets, and M being the number of elements in the resulting sorted set. /// - Categories: @read, @sortedset, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): the result of the union with, optionally, their scores when _WITHSCORES_ is used. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): the result of the union with, optionally, their scores when _WITHSCORES_ is used. @inlinable - public func zunion(key: [RedisKey], weight: [Int] = [], aggregate: ZUNION.Aggregate? = nil, withscores: Bool = false) async throws -> [RESPToken] { + public func zunion(key: [RESPKey], weight: [Int] = [], aggregate: ZUNION.Aggregate? = nil, withscores: Bool = false) async throws -> [RESPToken] { try await send(command: ZUNION(key: key, weight: weight, aggregate: aggregate, withscores: withscores)) } /// Stores the union of multiple sorted sets in a key. /// - /// - Documentation: [ZUNIONSTORE](https:/redis.io/docs/latest/commands/zunionstore) + /// - Documentation: [ZUNIONSTORE](https:/valkey.io/commands/zunionstore) /// - Version: 2.0.0 /// - Complexity: O(N)+O(M log(M)) with N being the sum of the sizes of the input sorted sets, and M being the number of elements in the resulting sorted set. /// - Categories: @write, @sortedset, @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of elements in the resulting sorted set. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of elements in the resulting sorted set. @inlinable - public func zunionstore(destination: RedisKey, key: [RedisKey], weight: [Int] = [], aggregate: ZUNIONSTORE.Aggregate? = nil) async throws -> Int { + public func zunionstore(destination: RESPKey, key: [RESPKey], weight: [Int] = [], aggregate: ZUNIONSTORE.Aggregate? = nil) async throws -> Int { try await send(command: ZUNIONSTORE(destination: destination, key: key, weight: weight, aggregate: aggregate)) } diff --git a/Sources/RedisCommands/StreamCommands.swift b/Sources/Valkey/Commands/StreamCommands.swift similarity index 61% rename from Sources/RedisCommands/StreamCommands.swift rename to Sources/Valkey/Commands/StreamCommands.swift index fff8dbbd..03572c0a 100644 --- a/Sources/RedisCommands/StreamCommands.swift +++ b/Sources/Valkey/Commands/StreamCommands.swift @@ -1,21 +1,20 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -// This file is autogenerated by RedisCommandsBuilder +// This file is autogenerated by ValkeyCommandsBuilder import NIOCore -import Redis #if canImport(FoundationEssentials) import FoundationEssentials @@ -26,13 +25,13 @@ import Foundation /// A container for consumer groups commands. public enum XGROUP { /// Creates a consumer group. - public struct CREATE: RedisCommand { + public struct CREATE: RESPCommand { public enum IdSelector: RESPRenderable { case id(String) case newId @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .id(let id): id.encode(into: &commandEncoder) case .newId: "$".encode(into: &commandEncoder) @@ -41,13 +40,13 @@ public enum XGROUP { } public typealias Response = RESPToken - public var key: RedisKey + public var key: RESPKey public var group: String public var idSelector: IdSelector public var mkstream: Bool = false public var entriesRead: Int? = nil - @inlinable public init(key: RedisKey, group: String, idSelector: IdSelector, mkstream: Bool = false, entriesRead: Int? = nil) { + @inlinable public init(key: RESPKey, group: String, idSelector: IdSelector, mkstream: Bool = false, entriesRead: Int? = nil) { self.key = key self.group = group self.idSelector = idSelector @@ -55,87 +54,87 @@ public enum XGROUP { self.entriesRead = entriesRead } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("XGROUP", "CREATE", key, group, idSelector, RedisPureToken("MKSTREAM", mkstream), RESPWithToken("ENTRIESREAD", entriesRead)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("XGROUP", "CREATE", key, group, idSelector, RESPPureToken("MKSTREAM", mkstream), RESPWithToken("ENTRIESREAD", entriesRead)) } } /// Creates a consumer in a consumer group. - public struct CREATECONSUMER: RedisCommand { + public struct CREATECONSUMER: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var group: String public var consumer: String - @inlinable public init(key: RedisKey, group: String, consumer: String) { + @inlinable public init(key: RESPKey, group: String, consumer: String) { self.key = key self.group = group self.consumer = consumer } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("XGROUP", "CREATECONSUMER", key, group, consumer) } } /// Deletes a consumer from a consumer group. - public struct DELCONSUMER: RedisCommand { + public struct DELCONSUMER: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var group: String public var consumer: String - @inlinable public init(key: RedisKey, group: String, consumer: String) { + @inlinable public init(key: RESPKey, group: String, consumer: String) { self.key = key self.group = group self.consumer = consumer } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("XGROUP", "DELCONSUMER", key, group, consumer) } } /// Destroys a consumer group. - public struct DESTROY: RedisCommand { + public struct DESTROY: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var group: String - @inlinable public init(key: RedisKey, group: String) { + @inlinable public init(key: RESPKey, group: String) { self.key = key self.group = group } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("XGROUP", "DESTROY", key, group) } } /// Returns helpful text about the different subcommands. - public struct HELP: RedisCommand { + public struct HELP: RESPCommand { public typealias Response = [RESPToken] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("XGROUP", "HELP") } } /// Sets the last-delivered ID of a consumer group. - public struct SETID: RedisCommand { + public struct SETID: RESPCommand { public enum IdSelector: RESPRenderable { case id(String) case newId @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .id(let id): id.encode(into: &commandEncoder) case .newId: "$".encode(into: &commandEncoder) @@ -144,19 +143,19 @@ public enum XGROUP { } public typealias Response = RESPToken - public var key: RedisKey + public var key: RESPKey public var group: String public var idSelector: IdSelector public var entriesread: Int? = nil - @inlinable public init(key: RedisKey, group: String, idSelector: IdSelector, entriesread: Int? = nil) { + @inlinable public init(key: RESPKey, group: String, idSelector: IdSelector, entriesread: Int? = nil) { self.key = key self.group = group self.idSelector = idSelector self.entriesread = entriesread } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("XGROUP", "SETID", key, group, idSelector, RESPWithToken("ENTRIESREAD", entriesread)) } } @@ -166,58 +165,58 @@ public enum XGROUP { /// A container for stream introspection commands. public enum XINFO { /// Returns a list of the consumers in a consumer group. - public struct CONSUMERS: RedisCommand { + public struct CONSUMERS: RESPCommand { public typealias Response = [RESPToken] - public var key: RedisKey + public var key: RESPKey public var group: String - @inlinable public init(key: RedisKey, group: String) { + @inlinable public init(key: RESPKey, group: String) { self.key = key self.group = group } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("XINFO", "CONSUMERS", key, group) } } /// Returns a list of the consumer groups of a stream. - public struct GROUPS: RedisCommand { + public struct GROUPS: RESPCommand { public typealias Response = [RESPToken] - public var key: RedisKey + public var key: RESPKey - @inlinable public init(key: RedisKey) { + @inlinable public init(key: RESPKey) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("XINFO", "GROUPS", key) } } /// Returns helpful text about the different subcommands. - public struct HELP: RedisCommand { + public struct HELP: RESPCommand { public typealias Response = [RESPToken] @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("XINFO", "HELP") } } /// Returns information about a stream. - public struct STREAM: RedisCommand { + public struct STREAM: RESPCommand { public struct FullBlock: RESPRenderable { @usableFromInline let full: Bool @usableFromInline let count: Int? @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 if self.full { count += "FULL".encode(into: &commandEncoder) } count += RESPWithToken("COUNT", count).encode(into: &commandEncoder) @@ -226,15 +225,15 @@ public enum XINFO { } public typealias Response = [String: RESPToken] - public var key: RedisKey + public var key: RESPKey public var fullBlock: FullBlock? = nil - @inlinable public init(key: RedisKey, fullBlock: FullBlock? = nil) { + @inlinable public init(key: RESPKey, fullBlock: FullBlock? = nil) { self.key = key self.fullBlock = fullBlock } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("XINFO", "STREAM", key, fullBlock) } } @@ -242,32 +241,32 @@ public enum XINFO { } /// Returns the number of messages that were successfully acknowledged by the consumer group member of a stream. -public struct XACK: RedisCommand { +public struct XACK: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var group: String public var id: [String] - @inlinable public init(key: RedisKey, group: String, id: [String]) { + @inlinable public init(key: RESPKey, group: String, id: [String]) { self.key = key self.group = group self.id = id } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("XACK", key, group, id) } } /// Appends a new message to a stream. Creates the key if it doesn't exist. -public struct XADD: RedisCommand { +public struct XADD: RESPCommand { public enum TrimStrategy: RESPRenderable { case maxlen case minid @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .maxlen: "MAXLEN".encode(into: &commandEncoder) case .minid: "MINID".encode(into: &commandEncoder) @@ -279,7 +278,7 @@ public struct XADD: RedisCommand { case approximately @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .equal: "=".encode(into: &commandEncoder) case .approximately: "~".encode(into: &commandEncoder) @@ -293,7 +292,7 @@ public struct XADD: RedisCommand { @usableFromInline let count: Int? @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += strategy.encode(into: &commandEncoder) count += `operator`.encode(into: &commandEncoder) @@ -307,7 +306,7 @@ public struct XADD: RedisCommand { case id(String) @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .autoId: "*".encode(into: &commandEncoder) case .id(let id): id.encode(into: &commandEncoder) @@ -319,7 +318,7 @@ public struct XADD: RedisCommand { @usableFromInline let value: String @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += field.encode(into: &commandEncoder) count += value.encode(into: &commandEncoder) @@ -328,13 +327,13 @@ public struct XADD: RedisCommand { } public typealias Response = String? - public var key: RedisKey + public var key: RESPKey public var nomkstream: Bool = false public var trim: Trim? = nil public var idSelector: IdSelector public var data: [Data] - @inlinable public init(key: RedisKey, nomkstream: Bool = false, trim: Trim? = nil, idSelector: IdSelector, data: [Data]) { + @inlinable public init(key: RESPKey, nomkstream: Bool = false, trim: Trim? = nil, idSelector: IdSelector, data: [Data]) { self.key = key self.nomkstream = nomkstream self.trim = trim @@ -342,16 +341,16 @@ public struct XADD: RedisCommand { self.data = data } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("XADD", key, RedisPureToken("NOMKSTREAM", nomkstream), trim, idSelector, data) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("XADD", key, RESPPureToken("NOMKSTREAM", nomkstream), trim, idSelector, data) } } /// Changes, or acquires, ownership of messages in a consumer group, as if the messages were delivered to as consumer group member. -public struct XAUTOCLAIM: RedisCommand { +public struct XAUTOCLAIM: RESPCommand { public typealias Response = [RESPToken] - public var key: RedisKey + public var key: RESPKey public var group: String public var consumer: String public var minIdleTime: String @@ -359,7 +358,7 @@ public struct XAUTOCLAIM: RedisCommand { public var count: Int? = nil public var justid: Bool = false - @inlinable public init(key: RedisKey, group: String, consumer: String, minIdleTime: String, start: String, count: Int? = nil, justid: Bool = false) { + @inlinable public init(key: RESPKey, group: String, consumer: String, minIdleTime: String, start: String, count: Int? = nil, justid: Bool = false) { self.key = key self.group = group self.consumer = consumer @@ -369,16 +368,16 @@ public struct XAUTOCLAIM: RedisCommand { self.justid = justid } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("XAUTOCLAIM", key, group, consumer, minIdleTime, start, RESPWithToken("COUNT", count), RedisPureToken("JUSTID", justid)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("XAUTOCLAIM", key, group, consumer, minIdleTime, start, RESPWithToken("COUNT", count), RESPPureToken("JUSTID", justid)) } } /// Changes, or acquires, ownership of a message in a consumer group, as if the message was delivered a consumer group member. -public struct XCLAIM: RedisCommand { +public struct XCLAIM: RESPCommand { public typealias Response = [RESPToken] - public var key: RedisKey + public var key: RESPKey public var group: String public var consumer: String public var minIdleTime: String @@ -390,7 +389,7 @@ public struct XCLAIM: RedisCommand { public var justid: Bool = false public var lastid: String? = nil - @inlinable public init(key: RedisKey, group: String, consumer: String, minIdleTime: String, id: [String], ms: Int? = nil, unixTimeMilliseconds: Date? = nil, count: Int? = nil, force: Bool = false, justid: Bool = false, lastid: String? = nil) { + @inlinable public init(key: RESPKey, group: String, consumer: String, minIdleTime: String, id: [String], ms: Int? = nil, unixTimeMilliseconds: Date? = nil, count: Int? = nil, force: Bool = false, justid: Bool = false, lastid: String? = nil) { self.key = key self.group = group self.consumer = consumer @@ -404,45 +403,45 @@ public struct XCLAIM: RedisCommand { self.lastid = lastid } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("XCLAIM", key, group, consumer, minIdleTime, id, RESPWithToken("IDLE", ms), RESPWithToken("TIME", unixTimeMilliseconds.map { Int($0.timeIntervalSince1970 * 1000) }), RESPWithToken("RETRYCOUNT", count), RedisPureToken("FORCE", force), RedisPureToken("JUSTID", justid), RESPWithToken("LASTID", lastid)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("XCLAIM", key, group, consumer, minIdleTime, id, RESPWithToken("IDLE", ms), RESPWithToken("TIME", unixTimeMilliseconds.map { Int($0.timeIntervalSince1970 * 1000) }), RESPWithToken("RETRYCOUNT", count), RESPPureToken("FORCE", force), RESPPureToken("JUSTID", justid), RESPWithToken("LASTID", lastid)) } } /// Returns the number of messages after removing them from a stream. -public struct XDEL: RedisCommand { +public struct XDEL: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var id: [String] - @inlinable public init(key: RedisKey, id: [String]) { + @inlinable public init(key: RESPKey, id: [String]) { self.key = key self.id = id } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("XDEL", key, id) } } /// Return the number of messages in a stream. -public struct XLEN: RedisCommand { +public struct XLEN: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey - @inlinable public init(key: RedisKey) { + @inlinable public init(key: RESPKey) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("XLEN", key) } } /// Returns the information and entries from a stream consumer group's pending entries list. -public struct XPENDING: RedisCommand { +public struct XPENDING: RESPCommand { public struct Filters: RESPRenderable { @usableFromInline let minIdleTime: Int? @usableFromInline let start: String @@ -451,7 +450,7 @@ public struct XPENDING: RedisCommand { @usableFromInline let consumer: String? @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += RESPWithToken("IDLE", minIdleTime).encode(into: &commandEncoder) count += start.encode(into: &commandEncoder) @@ -463,50 +462,50 @@ public struct XPENDING: RedisCommand { } public typealias Response = [RESPToken] - public var key: RedisKey + public var key: RESPKey public var group: String public var filters: Filters? = nil - @inlinable public init(key: RedisKey, group: String, filters: Filters? = nil) { + @inlinable public init(key: RESPKey, group: String, filters: Filters? = nil) { self.key = key self.group = group self.filters = filters } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("XPENDING", key, group, filters) } } /// Returns the messages from a stream within a range of IDs. -public struct XRANGE: RedisCommand { +public struct XRANGE: RESPCommand { public typealias Response = [RESPToken] - public var key: RedisKey + public var key: RESPKey public var start: String public var end: String public var count: Int? = nil - @inlinable public init(key: RedisKey, start: String, end: String, count: Int? = nil) { + @inlinable public init(key: RESPKey, start: String, end: String, count: Int? = nil) { self.key = key self.start = start self.end = end self.count = count } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("XRANGE", key, start, end, RESPWithToken("COUNT", count)) } } /// Returns messages from multiple streams with IDs greater than the ones requested. Blocks until a message is available otherwise. -public struct XREAD: RedisCommand { +public struct XREAD: RESPCommand { public struct Streams: RESPRenderable { - @usableFromInline let key: [RedisKey] + @usableFromInline let key: [RESPKey] @usableFromInline let id: [String] @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += key.encode(into: &commandEncoder) count += id.encode(into: &commandEncoder) @@ -525,19 +524,19 @@ public struct XREAD: RedisCommand { self.streams = streams } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("XREAD", RESPWithToken("COUNT", count), RESPWithToken("BLOCK", milliseconds), RESPWithToken("STREAMS", streams)) } } /// Returns new or historical messages from a stream for a consumer in a group. Blocks until a message is available otherwise. -public struct XREADGROUP: RedisCommand { +public struct XREADGROUP: RESPCommand { public struct GroupBlock: RESPRenderable { @usableFromInline let group: String @usableFromInline let consumer: String @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += group.encode(into: &commandEncoder) count += consumer.encode(into: &commandEncoder) @@ -545,11 +544,11 @@ public struct XREADGROUP: RedisCommand { } } public struct Streams: RESPRenderable { - @usableFromInline let key: [RedisKey] + @usableFromInline let key: [RESPKey] @usableFromInline let id: [String] @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += key.encode(into: &commandEncoder) count += id.encode(into: &commandEncoder) @@ -572,61 +571,61 @@ public struct XREADGROUP: RedisCommand { self.streams = streams } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("XREADGROUP", RESPWithToken("GROUP", groupBlock), RESPWithToken("COUNT", count), RESPWithToken("BLOCK", milliseconds), RedisPureToken("NOACK", noack), RESPWithToken("STREAMS", streams)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("XREADGROUP", RESPWithToken("GROUP", groupBlock), RESPWithToken("COUNT", count), RESPWithToken("BLOCK", milliseconds), RESPPureToken("NOACK", noack), RESPWithToken("STREAMS", streams)) } } /// Returns the messages from a stream within a range of IDs in reverse order. -public struct XREVRANGE: RedisCommand { +public struct XREVRANGE: RESPCommand { public typealias Response = [RESPToken] - public var key: RedisKey + public var key: RESPKey public var end: String public var start: String public var count: Int? = nil - @inlinable public init(key: RedisKey, end: String, start: String, count: Int? = nil) { + @inlinable public init(key: RESPKey, end: String, start: String, count: Int? = nil) { self.key = key self.end = end self.start = start self.count = count } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("XREVRANGE", key, end, start, RESPWithToken("COUNT", count)) } } /// An internal command for replicating stream values. -public struct XSETID: RedisCommand { +public struct XSETID: RESPCommand { public typealias Response = RESPToken - public var key: RedisKey + public var key: RESPKey public var lastId: String public var entriesAdded: Int? = nil public var maxDeletedId: String? = nil - @inlinable public init(key: RedisKey, lastId: String, entriesAdded: Int? = nil, maxDeletedId: String? = nil) { + @inlinable public init(key: RESPKey, lastId: String, entriesAdded: Int? = nil, maxDeletedId: String? = nil) { self.key = key self.lastId = lastId self.entriesAdded = entriesAdded self.maxDeletedId = maxDeletedId } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("XSETID", key, lastId, RESPWithToken("ENTRIESADDED", entriesAdded), RESPWithToken("MAXDELETEDID", maxDeletedId)) } } /// Deletes messages from the beginning of a stream. -public struct XTRIM: RedisCommand { +public struct XTRIM: RESPCommand { public enum TrimStrategy: RESPRenderable { case maxlen case minid @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .maxlen: "MAXLEN".encode(into: &commandEncoder) case .minid: "MINID".encode(into: &commandEncoder) @@ -638,7 +637,7 @@ public struct XTRIM: RedisCommand { case approximately @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .equal: "=".encode(into: &commandEncoder) case .approximately: "~".encode(into: &commandEncoder) @@ -652,7 +651,7 @@ public struct XTRIM: RedisCommand { @usableFromInline let count: Int? @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += strategy.encode(into: &commandEncoder) count += `operator`.encode(into: &commandEncoder) @@ -663,143 +662,143 @@ public struct XTRIM: RedisCommand { } public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var trim: Trim - @inlinable public init(key: RedisKey, trim: Trim) { + @inlinable public init(key: RESPKey, trim: Trim) { self.key = key self.trim = trim } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("XTRIM", key, trim) } } -extension RedisConnection { +extension ValkeyConnection { /// Returns the number of messages that were successfully acknowledged by the consumer group member of a stream. /// - /// - Documentation: [XACK](https:/redis.io/docs/latest/commands/xack) + /// - Documentation: [XACK](https:/valkey.io/commands/xack) /// - Version: 5.0.0 /// - Complexity: O(1) for each message ID processed. /// - Categories: @write, @stream, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): The command returns the number of messages successfully acknowledged. Certain message IDs may no longer be part of the PEL (for example because they have already been acknowledged), and XACK will not count them as successfully acknowledged. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): The command returns the number of messages successfully acknowledged. Certain message IDs may no longer be part of the PEL (for example because they have already been acknowledged), and XACK will not count them as successfully acknowledged. @inlinable - public func xack(key: RedisKey, group: String, id: [String]) async throws -> Int { + public func xack(key: RESPKey, group: String, id: [String]) async throws -> Int { try await send(command: XACK(key: key, group: group, id: id)) } /// Appends a new message to a stream. Creates the key if it doesn't exist. /// - /// - Documentation: [XADD](https:/redis.io/docs/latest/commands/xadd) + /// - Documentation: [XADD](https:/valkey.io/commands/xadd) /// - Version: 5.0.0 /// - Complexity: O(1) when adding a new entry, O(N) when trimming where N being the number of entries evicted. /// - Categories: @write, @stream, @fast /// - Returns: One of the following: - /// * [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): The ID of the added entry. The ID is the one automatically generated if an asterisk (`*`) is passed as the _id_ argument, otherwise the command just returns the same ID specified by the user during insertion. - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): if the NOMKSTREAM option is given and the key doesn't exist. + /// * [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): The ID of the added entry. The ID is the one automatically generated if an asterisk (`*`) is passed as the _id_ argument, otherwise the command just returns the same ID specified by the user during insertion. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): if the NOMKSTREAM option is given and the key doesn't exist. @inlinable - public func xadd(key: RedisKey, nomkstream: Bool = false, trim: XADD.Trim? = nil, idSelector: XADD.IdSelector, data: [XADD.Data]) async throws -> String? { + public func xadd(key: RESPKey, nomkstream: Bool = false, trim: XADD.Trim? = nil, idSelector: XADD.IdSelector, data: [XADD.Data]) async throws -> String? { try await send(command: XADD(key: key, nomkstream: nomkstream, trim: trim, idSelector: idSelector, data: data)) } /// Changes, or acquires, ownership of messages in a consumer group, as if the messages were delivered to as consumer group member. /// - /// - Documentation: [XAUTOCLAIM](https:/redis.io/docs/latest/commands/xautoclaim) + /// - Documentation: [XAUTOCLAIM](https:/valkey.io/commands/xautoclaim) /// - Version: 6.2.0 /// - Complexity: O(1) if COUNT is small. /// - Categories: @write, @stream, @fast - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays), specifically, an array with three elements: + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays), specifically, an array with three elements: /// 1. A stream ID to be used as the _start_ argument for the next call to XAUTOCLAIM. - /// 2. An [Array](https:/redis.io/docs/reference/protocol-spec#arrays) containing all the successfully claimed messages in the same format as `XRANGE`. - /// 3. An [Array](https:/redis.io/docs/reference/protocol-spec#arrays) containing message IDs that no longer exist in the stream, and were deleted from the PEL in which they were found. + /// 2. An [Array](https:/valkey.io/topics/protocol/#arrays) containing all the successfully claimed messages in the same format as `XRANGE`. + /// 3. An [Array](https:/valkey.io/topics/protocol/#arrays) containing message IDs that no longer exist in the stream, and were deleted from the PEL in which they were found. @inlinable - public func xautoclaim(key: RedisKey, group: String, consumer: String, minIdleTime: String, start: String, count: Int? = nil, justid: Bool = false) async throws -> [RESPToken] { + public func xautoclaim(key: RESPKey, group: String, consumer: String, minIdleTime: String, start: String, count: Int? = nil, justid: Bool = false) async throws -> [RESPToken] { try await send(command: XAUTOCLAIM(key: key, group: group, consumer: consumer, minIdleTime: minIdleTime, start: start, count: count, justid: justid)) } /// Changes, or acquires, ownership of a message in a consumer group, as if the message was delivered a consumer group member. /// - /// - Documentation: [XCLAIM](https:/redis.io/docs/latest/commands/xclaim) + /// - Documentation: [XCLAIM](https:/valkey.io/commands/xclaim) /// - Version: 5.0.0 /// - Complexity: O(log N) with N being the number of messages in the PEL of the consumer group. /// - Categories: @write, @stream, @fast /// - Returns: Any of the following: - /// * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): when the _JUSTID_ option is specified, an array of IDs of messages successfully claimed. - /// * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): an array of stream entries, each of which contains an array of two elements, the entry ID and the entry data itself. + /// * [Array](https:/valkey.io/topics/protocol/#arrays): when the _JUSTID_ option is specified, an array of IDs of messages successfully claimed. + /// * [Array](https:/valkey.io/topics/protocol/#arrays): an array of stream entries, each of which contains an array of two elements, the entry ID and the entry data itself. @inlinable - public func xclaim(key: RedisKey, group: String, consumer: String, minIdleTime: String, id: [String], ms: Int? = nil, unixTimeMilliseconds: Date? = nil, count: Int? = nil, force: Bool = false, justid: Bool = false, lastid: String? = nil) async throws -> [RESPToken] { + public func xclaim(key: RESPKey, group: String, consumer: String, minIdleTime: String, id: [String], ms: Int? = nil, unixTimeMilliseconds: Date? = nil, count: Int? = nil, force: Bool = false, justid: Bool = false, lastid: String? = nil) async throws -> [RESPToken] { try await send(command: XCLAIM(key: key, group: group, consumer: consumer, minIdleTime: minIdleTime, id: id, ms: ms, unixTimeMilliseconds: unixTimeMilliseconds, count: count, force: force, justid: justid, lastid: lastid)) } /// Returns the number of messages after removing them from a stream. /// - /// - Documentation: [XDEL](https:/redis.io/docs/latest/commands/xdel) + /// - Documentation: [XDEL](https:/valkey.io/commands/xdel) /// - Version: 5.0.0 /// - Complexity: O(1) for each single item to delete in the stream, regardless of the stream size. /// - Categories: @write, @stream, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of entries that were deleted. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of entries that were deleted. @inlinable - public func xdel(key: RedisKey, id: [String]) async throws -> Int { + public func xdel(key: RESPKey, id: [String]) async throws -> Int { try await send(command: XDEL(key: key, id: id)) } /// Creates a consumer group. /// - /// - Documentation: [XGROUP CREATE](https:/redis.io/docs/latest/commands/xgroup-create) + /// - Documentation: [XGROUP CREATE](https:/valkey.io/commands/xgroup-create) /// - Version: 5.0.0 /// - Complexity: O(1) /// - Categories: @write, @stream, @slow - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable - public func xgroupCreate(key: RedisKey, group: String, idSelector: XGROUP.CREATE.IdSelector, mkstream: Bool = false, entriesRead: Int? = nil) async throws -> RESPToken { + public func xgroupCreate(key: RESPKey, group: String, idSelector: XGROUP.CREATE.IdSelector, mkstream: Bool = false, entriesRead: Int? = nil) async throws -> RESPToken { try await send(command: XGROUP.CREATE(key: key, group: group, idSelector: idSelector, mkstream: mkstream, entriesRead: entriesRead)) } /// Creates a consumer in a consumer group. /// - /// - Documentation: [XGROUP CREATECONSUMER](https:/redis.io/docs/latest/commands/xgroup-createconsumer) + /// - Documentation: [XGROUP CREATECONSUMER](https:/valkey.io/commands/xgroup-createconsumer) /// - Version: 6.2.0 /// - Complexity: O(1) /// - Categories: @write, @stream, @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of created consumers, either 0 or 1. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of created consumers, either 0 or 1. @inlinable - public func xgroupCreateconsumer(key: RedisKey, group: String, consumer: String) async throws -> Int { + public func xgroupCreateconsumer(key: RESPKey, group: String, consumer: String) async throws -> Int { try await send(command: XGROUP.CREATECONSUMER(key: key, group: group, consumer: consumer)) } /// Deletes a consumer from a consumer group. /// - /// - Documentation: [XGROUP DELCONSUMER](https:/redis.io/docs/latest/commands/xgroup-delconsumer) + /// - Documentation: [XGROUP DELCONSUMER](https:/valkey.io/commands/xgroup-delconsumer) /// - Version: 5.0.0 /// - Complexity: O(1) /// - Categories: @write, @stream, @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of pending messages the consumer had before it was deleted. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of pending messages the consumer had before it was deleted. @inlinable - public func xgroupDelconsumer(key: RedisKey, group: String, consumer: String) async throws -> Int { + public func xgroupDelconsumer(key: RESPKey, group: String, consumer: String) async throws -> Int { try await send(command: XGROUP.DELCONSUMER(key: key, group: group, consumer: consumer)) } /// Destroys a consumer group. /// - /// - Documentation: [XGROUP DESTROY](https:/redis.io/docs/latest/commands/xgroup-destroy) + /// - Documentation: [XGROUP DESTROY](https:/valkey.io/commands/xgroup-destroy) /// - Version: 5.0.0 /// - Complexity: O(N) where N is the number of entries in the group's pending entries list (PEL). /// - Categories: @write, @stream, @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of destroyed consumer groups, either 0 or 1. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of destroyed consumer groups, either 0 or 1. @inlinable - public func xgroupDestroy(key: RedisKey, group: String) async throws -> Int { + public func xgroupDestroy(key: RESPKey, group: String) async throws -> Int { try await send(command: XGROUP.DESTROY(key: key, group: group)) } /// Returns helpful text about the different subcommands. /// - /// - Documentation: [XGROUP HELP](https:/redis.io/docs/latest/commands/xgroup-help) + /// - Documentation: [XGROUP HELP](https:/valkey.io/commands/xgroup-help) /// - Version: 5.0.0 /// - Complexity: O(1) /// - Categories: @stream, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of sub-commands and their descriptions. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of sub-commands and their descriptions. @inlinable public func xgroupHelp() async throws -> [RESPToken] { try await send(command: XGROUP.HELP()) @@ -807,47 +806,47 @@ extension RedisConnection { /// Sets the last-delivered ID of a consumer group. /// - /// - Documentation: [XGROUP SETID](https:/redis.io/docs/latest/commands/xgroup-setid) + /// - Documentation: [XGROUP SETID](https:/valkey.io/commands/xgroup-setid) /// - Version: 5.0.0 /// - Complexity: O(1) /// - Categories: @write, @stream, @slow - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable - public func xgroupSetid(key: RedisKey, group: String, idSelector: XGROUP.SETID.IdSelector, entriesread: Int? = nil) async throws -> RESPToken { + public func xgroupSetid(key: RESPKey, group: String, idSelector: XGROUP.SETID.IdSelector, entriesread: Int? = nil) async throws -> RESPToken { try await send(command: XGROUP.SETID(key: key, group: group, idSelector: idSelector, entriesread: entriesread)) } /// Returns a list of the consumers in a consumer group. /// - /// - Documentation: [XINFO CONSUMERS](https:/redis.io/docs/latest/commands/xinfo-consumers) + /// - Documentation: [XINFO CONSUMERS](https:/valkey.io/commands/xinfo-consumers) /// - Version: 5.0.0 /// - Complexity: O(1) /// - Categories: @read, @stream, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of consumers and their attributes. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of consumers and their attributes. @inlinable - public func xinfoConsumers(key: RedisKey, group: String) async throws -> [RESPToken] { + public func xinfoConsumers(key: RESPKey, group: String) async throws -> [RESPToken] { try await send(command: XINFO.CONSUMERS(key: key, group: group)) } /// Returns a list of the consumer groups of a stream. /// - /// - Documentation: [XINFO GROUPS](https:/redis.io/docs/latest/commands/xinfo-groups) + /// - Documentation: [XINFO GROUPS](https:/valkey.io/commands/xinfo-groups) /// - Version: 5.0.0 /// - Complexity: O(1) /// - Categories: @read, @stream, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of consumer groups. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of consumer groups. @inlinable - public func xinfoGroups(key: RedisKey) async throws -> [RESPToken] { + public func xinfoGroups(key: RESPKey) async throws -> [RESPToken] { try await send(command: XINFO.GROUPS(key: key)) } /// Returns helpful text about the different subcommands. /// - /// - Documentation: [XINFO HELP](https:/redis.io/docs/latest/commands/xinfo-help) + /// - Documentation: [XINFO HELP](https:/valkey.io/commands/xinfo-help) /// - Version: 5.0.0 /// - Complexity: O(1) /// - Categories: @stream, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of sub-commands and their descriptions. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of sub-commands and their descriptions. @inlinable public func xinfoHelp() async throws -> [RESPToken] { try await send(command: XINFO.HELP()) @@ -855,62 +854,62 @@ extension RedisConnection { /// Returns information about a stream. /// - /// - Documentation: [XINFO STREAM](https:/redis.io/docs/latest/commands/xinfo-stream) + /// - Documentation: [XINFO STREAM](https:/valkey.io/commands/xinfo-stream) /// - Version: 5.0.0 /// - Complexity: O(1) /// - Categories: @read, @stream, @slow /// - Returns: One of the following: - /// * [Map](https:/redis.io/docs/reference/protocol-spec#maps): when the _FULL_ argument was not given, a list of information about a stream in summary form. - /// * [Map](https:/redis.io/docs/reference/protocol-spec#maps): when the _FULL_ argument was given, a list of information about a stream in extended form. + /// * [Map](https:/valkey.io/topics/protocol/#maps): when the _FULL_ argument was not given, a list of information about a stream in summary form. + /// * [Map](https:/valkey.io/topics/protocol/#maps): when the _FULL_ argument was given, a list of information about a stream in extended form. @inlinable - public func xinfoStream(key: RedisKey, fullBlock: XINFO.STREAM.FullBlock? = nil) async throws -> [String: RESPToken] { + public func xinfoStream(key: RESPKey, fullBlock: XINFO.STREAM.FullBlock? = nil) async throws -> [String: RESPToken] { try await send(command: XINFO.STREAM(key: key, fullBlock: fullBlock)) } /// Return the number of messages in a stream. /// - /// - Documentation: [XLEN](https:/redis.io/docs/latest/commands/xlen) + /// - Documentation: [XLEN](https:/valkey.io/commands/xlen) /// - Version: 5.0.0 /// - Complexity: O(1) /// - Categories: @read, @stream, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the number of entries of the stream at _key_. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the number of entries of the stream at _key_. @inlinable - public func xlen(key: RedisKey) async throws -> Int { + public func xlen(key: RESPKey) async throws -> Int { try await send(command: XLEN(key: key)) } /// Returns the information and entries from a stream consumer group's pending entries list. /// - /// - Documentation: [XPENDING](https:/redis.io/docs/latest/commands/xpending) + /// - Documentation: [XPENDING](https:/valkey.io/commands/xpending) /// - Version: 5.0.0 /// - Complexity: O(N) with N being the number of elements returned, so asking for a small fixed number of entries per call is O(1). O(M), where M is the total number of entries scanned when used with the IDLE filter. When the command returns just the summary and the list of consumers is small, it runs in O(1) time; otherwise, an additional O(N) time for iterating every consumer. /// - Categories: @read, @stream, @slow - /// - Returns: * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): different data depending on the way XPENDING is called, as explained on this page. + /// - Returns: * [Array](https:/valkey.io/topics/protocol/#arrays): different data depending on the way XPENDING is called, as explained on this page. @inlinable - public func xpending(key: RedisKey, group: String, filters: XPENDING.Filters? = nil) async throws -> [RESPToken] { + public func xpending(key: RESPKey, group: String, filters: XPENDING.Filters? = nil) async throws -> [RESPToken] { try await send(command: XPENDING(key: key, group: group, filters: filters)) } /// Returns the messages from a stream within a range of IDs. /// - /// - Documentation: [XRANGE](https:/redis.io/docs/latest/commands/xrange) + /// - Documentation: [XRANGE](https:/valkey.io/commands/xrange) /// - Version: 5.0.0 /// - Complexity: O(N) with N being the number of elements being returned. If N is constant (e.g. always asking for the first 10 elements with COUNT), you can consider it O(1). /// - Categories: @read, @stream, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of stream entries with IDs matching the specified range. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of stream entries with IDs matching the specified range. @inlinable - public func xrange(key: RedisKey, start: String, end: String, count: Int? = nil) async throws -> [RESPToken] { + public func xrange(key: RESPKey, start: String, end: String, count: Int? = nil) async throws -> [RESPToken] { try await send(command: XRANGE(key: key, start: start, end: end, count: count)) } /// Returns messages from multiple streams with IDs greater than the ones requested. Blocks until a message is available otherwise. /// - /// - Documentation: [XREAD](https:/redis.io/docs/latest/commands/xread) + /// - Documentation: [XREAD](https:/valkey.io/commands/xread) /// - Version: 5.0.0 /// - Categories: @read, @stream, @slow, @blocking /// - Returns: One of the following: - /// * [Map](https:/redis.io/docs/reference/protocol-spec#maps): A map of key-value elements where each element is composed of the key name and the entries reported for that key. The entries reported are full stream entries, having IDs and the list of all the fields and values. Field and values are guaranteed to be reported in the same order they were added by `XADD`. - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): if the _BLOCK_ option is given and a timeout occurs, or if there is no stream that can be served. + /// * [Map](https:/valkey.io/topics/protocol/#maps): A map of key-value elements where each element is composed of the key name and the entries reported for that key. The entries reported are full stream entries, having IDs and the list of all the fields and values. Field and values are guaranteed to be reported in the same order they were added by `XADD`. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): if the _BLOCK_ option is given and a timeout occurs, or if there is no stream that can be served. @inlinable public func xread(count: Int? = nil, milliseconds: Int? = nil, streams: XREAD.Streams) async throws -> [String: RESPToken]? { try await send(command: XREAD(count: count, milliseconds: milliseconds, streams: streams)) @@ -918,13 +917,13 @@ extension RedisConnection { /// Returns new or historical messages from a stream for a consumer in a group. Blocks until a message is available otherwise. /// - /// - Documentation: [XREADGROUP](https:/redis.io/docs/latest/commands/xreadgroup) + /// - Documentation: [XREADGROUP](https:/valkey.io/commands/xreadgroup) /// - Version: 5.0.0 /// - Complexity: For each stream mentioned: O(M) with M being the number of elements returned. If M is constant (e.g. always asking for the first 10 elements with COUNT), you can consider it O(1). On the other side when XREADGROUP blocks, XADD will pay the O(N) time in order to serve the N clients blocked on the stream getting new data. /// - Categories: @write, @stream, @slow, @blocking /// - Returns: One of the following: - /// * [Map](https:/redis.io/docs/reference/protocol-spec#maps): A map of key-value elements where each element is composed of the key name and the entries reported for that key. The entries reported are full stream entries, having IDs and the list of all the fields and values. Field and values are guaranteed to be reported in the same order they were added by `XADD`. - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): if the _BLOCK_ option is given and a timeout occurs, or if there is no stream that can be served. + /// * [Map](https:/valkey.io/topics/protocol/#maps): A map of key-value elements where each element is composed of the key name and the entries reported for that key. The entries reported are full stream entries, having IDs and the list of all the fields and values. Field and values are guaranteed to be reported in the same order they were added by `XADD`. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): if the _BLOCK_ option is given and a timeout occurs, or if there is no stream that can be served. @inlinable public func xreadgroup(groupBlock: XREADGROUP.GroupBlock, count: Int? = nil, milliseconds: Int? = nil, noack: Bool = false, streams: XREADGROUP.Streams) async throws -> [String: RESPToken]? { try await send(command: XREADGROUP(groupBlock: groupBlock, count: count, milliseconds: milliseconds, noack: noack, streams: streams)) @@ -932,37 +931,37 @@ extension RedisConnection { /// Returns the messages from a stream within a range of IDs in reverse order. /// - /// - Documentation: [XREVRANGE](https:/redis.io/docs/latest/commands/xrevrange) + /// - Documentation: [XREVRANGE](https:/valkey.io/commands/xrevrange) /// - Version: 5.0.0 /// - Complexity: O(N) with N being the number of elements returned. If N is constant (e.g. always asking for the first 10 elements with COUNT), you can consider it O(1). /// - Categories: @read, @stream, @slow - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): The command returns the entries with IDs matching the specified range. The returned entries are complete, which means that the ID and all the fields they are composed of are returned. Moreover, the entries are returned with their fields and values in the same order as `XADD` added them. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): The command returns the entries with IDs matching the specified range. The returned entries are complete, which means that the ID and all the fields they are composed of are returned. Moreover, the entries are returned with their fields and values in the same order as `XADD` added them. @inlinable - public func xrevrange(key: RedisKey, end: String, start: String, count: Int? = nil) async throws -> [RESPToken] { + public func xrevrange(key: RESPKey, end: String, start: String, count: Int? = nil) async throws -> [RESPToken] { try await send(command: XREVRANGE(key: key, end: end, start: start, count: count)) } /// An internal command for replicating stream values. /// - /// - Documentation: [XSETID](https:/redis.io/docs/latest/commands/xsetid) + /// - Documentation: [XSETID](https:/valkey.io/commands/xsetid) /// - Version: 5.0.0 /// - Complexity: O(1) /// - Categories: @write, @stream, @fast - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable - public func xsetid(key: RedisKey, lastId: String, entriesAdded: Int? = nil, maxDeletedId: String? = nil) async throws -> RESPToken { + public func xsetid(key: RESPKey, lastId: String, entriesAdded: Int? = nil, maxDeletedId: String? = nil) async throws -> RESPToken { try await send(command: XSETID(key: key, lastId: lastId, entriesAdded: entriesAdded, maxDeletedId: maxDeletedId)) } /// Deletes messages from the beginning of a stream. /// - /// - Documentation: [XTRIM](https:/redis.io/docs/latest/commands/xtrim) + /// - Documentation: [XTRIM](https:/valkey.io/commands/xtrim) /// - Version: 5.0.0 /// - Complexity: O(N), with N being the number of evicted entries. Constant times are very small however, since entries are organized in macro nodes containing multiple entries that can be released with a single deallocation. /// - Categories: @write, @stream, @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): The number of entries deleted from the stream. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): The number of entries deleted from the stream. @inlinable - public func xtrim(key: RedisKey, trim: XTRIM.Trim) async throws -> Int { + public func xtrim(key: RESPKey, trim: XTRIM.Trim) async throws -> Int { try await send(command: XTRIM(key: key, trim: trim)) } diff --git a/Sources/RedisCommands/StringCommands.swift b/Sources/Valkey/Commands/StringCommands.swift similarity index 55% rename from Sources/RedisCommands/StringCommands.swift rename to Sources/Valkey/Commands/StringCommands.swift index b737d862..63548110 100644 --- a/Sources/RedisCommands/StringCommands.swift +++ b/Sources/Valkey/Commands/StringCommands.swift @@ -1,21 +1,20 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -// This file is autogenerated by RedisCommandsBuilder +// This file is autogenerated by ValkeyCommandsBuilder import NIOCore -import Redis #if canImport(FoundationEssentials) import FoundationEssentials @@ -24,86 +23,86 @@ import Foundation #endif /// Appends a string to the value of a key. Creates the key if it doesn't exist. -public struct APPEND: RedisCommand { +public struct APPEND: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var value: String - @inlinable public init(key: RedisKey, value: String) { + @inlinable public init(key: RESPKey, value: String) { self.key = key self.value = value } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("APPEND", key, value) } } /// Decrements the integer value of a key by one. Uses 0 as initial value if the key doesn't exist. -public struct DECR: RedisCommand { +public struct DECR: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey - @inlinable public init(key: RedisKey) { + @inlinable public init(key: RESPKey) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("DECR", key) } } /// Decrements a number from the integer value of a key. Uses 0 as initial value if the key doesn't exist. -public struct DECRBY: RedisCommand { +public struct DECRBY: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var decrement: Int - @inlinable public init(key: RedisKey, decrement: Int) { + @inlinable public init(key: RESPKey, decrement: Int) { self.key = key self.decrement = decrement } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("DECRBY", key, decrement) } } /// Returns the string value of a key. -public struct GET: RedisCommand { +public struct GET: RESPCommand { public typealias Response = String? - public var key: RedisKey + public var key: RESPKey - @inlinable public init(key: RedisKey) { + @inlinable public init(key: RESPKey) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("GET", key) } } /// Returns the string value of a key after deleting the key. -public struct GETDEL: RedisCommand { +public struct GETDEL: RESPCommand { public typealias Response = String? - public var key: RedisKey + public var key: RESPKey - @inlinable public init(key: RedisKey) { + @inlinable public init(key: RESPKey) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("GETDEL", key) } } /// Returns the string value of a key after setting its expiration time. -public struct GETEX: RedisCommand { +public struct GETEX: RESPCommand { public enum Expiration: RESPRenderable { case seconds(Int) case milliseconds(Int) @@ -112,7 +111,7 @@ public struct GETEX: RedisCommand { case persist @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .seconds(let seconds): RESPWithToken("EX", seconds).encode(into: &commandEncoder) case .milliseconds(let milliseconds): RESPWithToken("PX", milliseconds).encode(into: &commandEncoder) @@ -124,116 +123,116 @@ public struct GETEX: RedisCommand { } public typealias Response = String? - public var key: RedisKey + public var key: RESPKey public var expiration: Expiration? = nil - @inlinable public init(key: RedisKey, expiration: Expiration? = nil) { + @inlinable public init(key: RESPKey, expiration: Expiration? = nil) { self.key = key self.expiration = expiration } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("GETEX", key, expiration) } } /// Returns a substring of the string stored at a key. -public struct GETRANGE: RedisCommand { +public struct GETRANGE: RESPCommand { public typealias Response = String - public var key: RedisKey + public var key: RESPKey public var start: Int public var end: Int - @inlinable public init(key: RedisKey, start: Int, end: Int) { + @inlinable public init(key: RESPKey, start: Int, end: Int) { self.key = key self.start = start self.end = end } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("GETRANGE", key, start, end) } } /// Returns the previous string value of a key after setting it to a new value. -public struct GETSET: RedisCommand { +public struct GETSET: RESPCommand { public typealias Response = String? - public var key: RedisKey + public var key: RESPKey public var value: String - @inlinable public init(key: RedisKey, value: String) { + @inlinable public init(key: RESPKey, value: String) { self.key = key self.value = value } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("GETSET", key, value) } } /// Increments the integer value of a key by one. Uses 0 as initial value if the key doesn't exist. -public struct INCR: RedisCommand { +public struct INCR: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey - @inlinable public init(key: RedisKey) { + @inlinable public init(key: RESPKey) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("INCR", key) } } /// Increments the integer value of a key by a number. Uses 0 as initial value if the key doesn't exist. -public struct INCRBY: RedisCommand { +public struct INCRBY: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var increment: Int - @inlinable public init(key: RedisKey, increment: Int) { + @inlinable public init(key: RESPKey, increment: Int) { self.key = key self.increment = increment } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("INCRBY", key, increment) } } /// Increment the floating point value of a key by a number. Uses 0 as initial value if the key doesn't exist. -public struct INCRBYFLOAT: RedisCommand { +public struct INCRBYFLOAT: RESPCommand { public typealias Response = String - public var key: RedisKey + public var key: RESPKey public var increment: Double - @inlinable public init(key: RedisKey, increment: Double) { + @inlinable public init(key: RESPKey, increment: Double) { self.key = key self.increment = increment } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("INCRBYFLOAT", key, increment) } } /// Finds the longest common substring. -public struct LCS: RedisCommand { +public struct LCS: RESPCommand { public typealias Response = RESPToken - public var key1: RedisKey - public var key2: RedisKey + public var key1: RESPKey + public var key2: RESPKey public var len: Bool = false public var idx: Bool = false public var minMatchLen: Int? = nil public var withmatchlen: Bool = false - @inlinable public init(key1: RedisKey, key2: RedisKey, len: Bool = false, idx: Bool = false, minMatchLen: Int? = nil, withmatchlen: Bool = false) { + @inlinable public init(key1: RESPKey, key2: RESPKey, len: Bool = false, idx: Bool = false, minMatchLen: Int? = nil, withmatchlen: Bool = false) { self.key1 = key1 self.key2 = key2 self.len = len @@ -242,34 +241,34 @@ public struct LCS: RedisCommand { self.withmatchlen = withmatchlen } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("LCS", key1, key2, RedisPureToken("LEN", len), RedisPureToken("IDX", idx), RESPWithToken("MINMATCHLEN", minMatchLen), RedisPureToken("WITHMATCHLEN", withmatchlen)) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("LCS", key1, key2, RESPPureToken("LEN", len), RESPPureToken("IDX", idx), RESPWithToken("MINMATCHLEN", minMatchLen), RESPPureToken("WITHMATCHLEN", withmatchlen)) } } /// Atomically returns the string values of one or more keys. -public struct MGET: RedisCommand { +public struct MGET: RESPCommand { public typealias Response = [RESPToken] - public var key: [RedisKey] + public var key: [RESPKey] - @inlinable public init(key: [RedisKey]) { + @inlinable public init(key: [RESPKey]) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("MGET", key) } } /// Atomically creates or modifies the string values of one or more keys. -public struct MSET: RedisCommand { +public struct MSET: RESPCommand { public struct Data: RESPRenderable { - @usableFromInline let key: RedisKey + @usableFromInline let key: RESPKey @usableFromInline let value: String @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += key.encode(into: &commandEncoder) count += value.encode(into: &commandEncoder) @@ -284,19 +283,19 @@ public struct MSET: RedisCommand { self.data = data } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("MSET", data) } } /// Atomically modifies the string values of one or more keys only when all keys don't exist. -public struct MSETNX: RedisCommand { +public struct MSETNX: RESPCommand { public struct Data: RESPRenderable { - @usableFromInline let key: RedisKey + @usableFromInline let key: RESPKey @usableFromInline let value: String @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 count += key.encode(into: &commandEncoder) count += value.encode(into: &commandEncoder) @@ -311,38 +310,38 @@ public struct MSETNX: RedisCommand { self.data = data } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("MSETNX", data) } } /// Sets both string value and expiration time in milliseconds of a key. The key is created if it doesn't exist. -public struct PSETEX: RedisCommand { +public struct PSETEX: RESPCommand { public typealias Response = RESPToken - public var key: RedisKey + public var key: RESPKey public var milliseconds: Int public var value: String - @inlinable public init(key: RedisKey, milliseconds: Int, value: String) { + @inlinable public init(key: RESPKey, milliseconds: Int, value: String) { self.key = key self.milliseconds = milliseconds self.value = value } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("PSETEX", key, milliseconds, value) } } /// Sets the string value of a key, ignoring its type. The key is created if it doesn't exist. -public struct SET: RedisCommand { +public struct SET: RESPCommand { public enum Condition: RESPRenderable { case nx case xx @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .nx: "NX".encode(into: &commandEncoder) case .xx: "XX".encode(into: &commandEncoder) @@ -357,7 +356,7 @@ public struct SET: RedisCommand { case keepttl @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .seconds(let seconds): RESPWithToken("EX", seconds).encode(into: &commandEncoder) case .milliseconds(let milliseconds): RESPWithToken("PX", milliseconds).encode(into: &commandEncoder) @@ -369,13 +368,13 @@ public struct SET: RedisCommand { } public typealias Response = String? - public var key: RedisKey + public var key: RESPKey public var value: String public var condition: Condition? = nil public var get: Bool = false public var expiration: Expiration? = nil - @inlinable public init(key: RedisKey, value: String, condition: Condition? = nil, get: Bool = false, expiration: Expiration? = nil) { + @inlinable public init(key: RESPKey, value: String, condition: Condition? = nil, get: Bool = false, expiration: Expiration? = nil) { self.key = key self.value = value self.condition = condition @@ -383,275 +382,275 @@ public struct SET: RedisCommand { self.expiration = expiration } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { - commandEncoder.encodeArray("SET", key, value, condition, RedisPureToken("GET", get), expiration) + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { + commandEncoder.encodeArray("SET", key, value, condition, RESPPureToken("GET", get), expiration) } } /// Sets the string value and expiration time of a key. Creates the key if it doesn't exist. -public struct SETEX: RedisCommand { +public struct SETEX: RESPCommand { public typealias Response = RESPToken - public var key: RedisKey + public var key: RESPKey public var seconds: Int public var value: String - @inlinable public init(key: RedisKey, seconds: Int, value: String) { + @inlinable public init(key: RESPKey, seconds: Int, value: String) { self.key = key self.seconds = seconds self.value = value } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("SETEX", key, seconds, value) } } /// Set the string value of a key only when the key doesn't exist. -public struct SETNX: RedisCommand { +public struct SETNX: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var value: String - @inlinable public init(key: RedisKey, value: String) { + @inlinable public init(key: RESPKey, value: String) { self.key = key self.value = value } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("SETNX", key, value) } } /// Overwrites a part of a string value with another by an offset. Creates the key if it doesn't exist. -public struct SETRANGE: RedisCommand { +public struct SETRANGE: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey public var offset: Int public var value: String - @inlinable public init(key: RedisKey, offset: Int, value: String) { + @inlinable public init(key: RESPKey, offset: Int, value: String) { self.key = key self.offset = offset self.value = value } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("SETRANGE", key, offset, value) } } /// Returns the length of a string value. -public struct STRLEN: RedisCommand { +public struct STRLEN: RESPCommand { public typealias Response = Int - public var key: RedisKey + public var key: RESPKey - @inlinable public init(key: RedisKey) { + @inlinable public init(key: RESPKey) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("STRLEN", key) } } /// Returns a substring from a string value. -public struct SUBSTR: RedisCommand { +public struct SUBSTR: RESPCommand { public typealias Response = String - public var key: RedisKey + public var key: RESPKey public var start: Int public var end: Int - @inlinable public init(key: RedisKey, start: Int, end: Int) { + @inlinable public init(key: RESPKey, start: Int, end: Int) { self.key = key self.start = start self.end = end } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("SUBSTR", key, start, end) } } -extension RedisConnection { +extension ValkeyConnection { /// Appends a string to the value of a key. Creates the key if it doesn't exist. /// - /// - Documentation: [APPEND](https:/redis.io/docs/latest/commands/append) + /// - Documentation: [APPEND](https:/valkey.io/commands/append) /// - Version: 2.0.0 - /// - Complexity: O(1). The amortized time complexity is O(1) assuming the appended value is small and the already present value is of any size, since the dynamic string library used by Redis will double the free space available on every reallocation. + /// - Complexity: O(1). The amortized time complexity is O(1) assuming the appended value is small and the already present value is of any size, since the dynamic string library used by Valkey will double the free space available on every reallocation. /// - Categories: @write, @string, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the length of the string after the append operation. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the length of the string after the append operation. @inlinable - public func append(key: RedisKey, value: String) async throws -> Int { + public func append(key: RESPKey, value: String) async throws -> Int { try await send(command: APPEND(key: key, value: value)) } /// Decrements the integer value of a key by one. Uses 0 as initial value if the key doesn't exist. /// - /// - Documentation: [DECR](https:/redis.io/docs/latest/commands/decr) + /// - Documentation: [DECR](https:/valkey.io/commands/decr) /// - Version: 1.0.0 /// - Complexity: O(1) /// - Categories: @write, @string, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the value of the key after decrementing it. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the value of the key after decrementing it. @inlinable - public func decr(key: RedisKey) async throws -> Int { + public func decr(key: RESPKey) async throws -> Int { try await send(command: DECR(key: key)) } /// Decrements a number from the integer value of a key. Uses 0 as initial value if the key doesn't exist. /// - /// - Documentation: [DECRBY](https:/redis.io/docs/latest/commands/decrby) + /// - Documentation: [DECRBY](https:/valkey.io/commands/decrby) /// - Version: 1.0.0 /// - Complexity: O(1) /// - Categories: @write, @string, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the value of the key after decrementing it. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the value of the key after decrementing it. @inlinable - public func decrby(key: RedisKey, decrement: Int) async throws -> Int { + public func decrby(key: RESPKey, decrement: Int) async throws -> Int { try await send(command: DECRBY(key: key, decrement: decrement)) } /// Returns the string value of a key. /// - /// - Documentation: [GET](https:/redis.io/docs/latest/commands/get) + /// - Documentation: [GET](https:/valkey.io/commands/get) /// - Version: 1.0.0 /// - Complexity: O(1) /// - Categories: @read, @string, @fast /// - Returns: One of the following: - /// * [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): the value of the key. - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): key does not exist. + /// * [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): the value of the key. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): if the key does not exist. @inlinable - public func get(key: RedisKey) async throws -> String? { + public func get(key: RESPKey) async throws -> String? { try await send(command: GET(key: key)) } /// Returns the string value of a key after deleting the key. /// - /// - Documentation: [GETDEL](https:/redis.io/docs/latest/commands/getdel) + /// - Documentation: [GETDEL](https:/valkey.io/commands/getdel) /// - Version: 6.2.0 /// - Complexity: O(1) /// - Categories: @write, @string, @fast /// - Returns: One of the following: - /// * [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): the value of the key. - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): if the key does not exist or if the key's value type is not a string. + /// * [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): the value of the key. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): if the key does not exist or if the key's value type is not a string. @inlinable - public func getdel(key: RedisKey) async throws -> String? { + public func getdel(key: RESPKey) async throws -> String? { try await send(command: GETDEL(key: key)) } /// Returns the string value of a key after setting its expiration time. /// - /// - Documentation: [GETEX](https:/redis.io/docs/latest/commands/getex) + /// - Documentation: [GETEX](https:/valkey.io/commands/getex) /// - Version: 6.2.0 /// - Complexity: O(1) /// - Categories: @write, @string, @fast - /// - Returns: [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): the value of `key` - /// [Null](https:/redis.io/docs/reference/protocol-spec#nulls): if `key` does not exist. + /// - Returns: [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): the value of `key` + /// [Null](https:/valkey.io/topics/protocol/#nulls): if `key` does not exist. @inlinable - public func getex(key: RedisKey, expiration: GETEX.Expiration? = nil) async throws -> String? { + public func getex(key: RESPKey, expiration: GETEX.Expiration? = nil) async throws -> String? { try await send(command: GETEX(key: key, expiration: expiration)) } /// Returns a substring of the string stored at a key. /// - /// - Documentation: [GETRANGE](https:/redis.io/docs/latest/commands/getrange) + /// - Documentation: [GETRANGE](https:/valkey.io/commands/getrange) /// - Version: 2.4.0 /// - Complexity: O(N) where N is the length of the returned string. The complexity is ultimately determined by the returned length, but because creating a substring from an existing string is very cheap, it can be considered O(1) for small strings. /// - Categories: @read, @string, @slow - /// - Returns: [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): The substring of the string value stored at key, determined by the offsets start and end (both are inclusive). + /// - Returns: [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): The substring of the string value stored at key, determined by the offsets start and end (both are inclusive). @inlinable - public func getrange(key: RedisKey, start: Int, end: Int) async throws -> String { + public func getrange(key: RESPKey, start: Int, end: Int) async throws -> String { try await send(command: GETRANGE(key: key, start: start, end: end)) } /// Returns the previous string value of a key after setting it to a new value. /// - /// - Documentation: [GETSET](https:/redis.io/docs/latest/commands/getset) + /// - Documentation: [GETSET](https:/valkey.io/commands/getset) /// - Version: 1.0.0 /// - Complexity: O(1) /// - Categories: @write, @string, @fast /// - Returns: One of the following: - /// * [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): the old value stored at the key. - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): if the key does not exist. + /// * [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): the old value stored at the key. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): if the key does not exist. @inlinable - public func getset(key: RedisKey, value: String) async throws -> String? { + public func getset(key: RESPKey, value: String) async throws -> String? { try await send(command: GETSET(key: key, value: value)) } /// Increments the integer value of a key by one. Uses 0 as initial value if the key doesn't exist. /// - /// - Documentation: [INCR](https:/redis.io/docs/latest/commands/incr) + /// - Documentation: [INCR](https:/valkey.io/commands/incr) /// - Version: 1.0.0 /// - Complexity: O(1) /// - Categories: @write, @string, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the value of the key after the increment. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the value of the key after the increment. @inlinable - public func incr(key: RedisKey) async throws -> Int { + public func incr(key: RESPKey) async throws -> Int { try await send(command: INCR(key: key)) } /// Increments the integer value of a key by a number. Uses 0 as initial value if the key doesn't exist. /// - /// - Documentation: [INCRBY](https:/redis.io/docs/latest/commands/incrby) + /// - Documentation: [INCRBY](https:/valkey.io/commands/incrby) /// - Version: 1.0.0 /// - Complexity: O(1) /// - Categories: @write, @string, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the value of the key after the increment. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the value of the key after the increment. @inlinable - public func incrby(key: RedisKey, increment: Int) async throws -> Int { + public func incrby(key: RESPKey, increment: Int) async throws -> Int { try await send(command: INCRBY(key: key, increment: increment)) } /// Increment the floating point value of a key by a number. Uses 0 as initial value if the key doesn't exist. /// - /// - Documentation: [INCRBYFLOAT](https:/redis.io/docs/latest/commands/incrbyfloat) + /// - Documentation: [INCRBYFLOAT](https:/valkey.io/commands/incrbyfloat) /// - Version: 2.6.0 /// - Complexity: O(1) /// - Categories: @write, @string, @fast - /// - Returns: [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): the value of the key after the increment. + /// - Returns: [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): the value of the key after the increment. @inlinable - public func incrbyfloat(key: RedisKey, increment: Double) async throws -> String { + public func incrbyfloat(key: RESPKey, increment: Double) async throws -> String { try await send(command: INCRBYFLOAT(key: key, increment: increment)) } /// Finds the longest common substring. /// - /// - Documentation: [LCS](https:/redis.io/docs/latest/commands/lcs) + /// - Documentation: [LCS](https:/valkey.io/commands/lcs) /// - Version: 7.0.0 /// - Complexity: O(N*M) where N and M are the lengths of s1 and s2, respectively /// - Categories: @read, @string, @slow /// - Returns: One of the following: - /// * [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): the longest common subsequence. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the length of the longest common subsequence when _LEN_ is given. - /// * [Map](https:/redis.io/docs/reference/protocol-spec#maps): a map with the LCS length and all the ranges in both the strings when _IDX_ is given. + /// * [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): the longest common subsequence. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): the length of the longest common subsequence when _LEN_ is given. + /// * [Map](https:/valkey.io/topics/protocol/#maps): a map with the LCS length and all the ranges in both the strings when _IDX_ is given. @inlinable - public func lcs(key1: RedisKey, key2: RedisKey, len: Bool = false, idx: Bool = false, minMatchLen: Int? = nil, withmatchlen: Bool = false) async throws -> RESPToken { + public func lcs(key1: RESPKey, key2: RESPKey, len: Bool = false, idx: Bool = false, minMatchLen: Int? = nil, withmatchlen: Bool = false) async throws -> RESPToken { try await send(command: LCS(key1: key1, key2: key2, len: len, idx: idx, minMatchLen: minMatchLen, withmatchlen: withmatchlen)) } /// Atomically returns the string values of one or more keys. /// - /// - Documentation: [MGET](https:/redis.io/docs/latest/commands/mget) + /// - Documentation: [MGET](https:/valkey.io/commands/mget) /// - Version: 1.0.0 /// - Complexity: O(N) where N is the number of keys to retrieve. /// - Categories: @read, @string, @fast - /// - Returns: [Array](https:/redis.io/docs/reference/protocol-spec#arrays): a list of values at the specified keys. + /// - Returns: [Array](https:/valkey.io/topics/protocol/#arrays): a list of values at the specified keys. @inlinable - public func mget(key: [RedisKey]) async throws -> [RESPToken] { + public func mget(key: [RESPKey]) async throws -> [RESPToken] { try await send(command: MGET(key: key)) } /// Atomically creates or modifies the string values of one or more keys. /// - /// - Documentation: [MSET](https:/redis.io/docs/latest/commands/mset) + /// - Documentation: [MSET](https:/valkey.io/commands/mset) /// - Version: 1.0.1 /// - Complexity: O(N) where N is the number of keys to set. /// - Categories: @write, @string, @slow - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): always `OK` because `MSET` can't fail. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): always `OK` because `MSET` can't fail. @inlinable public func mset(data: [MSET.Data]) async throws -> RESPToken { try await send(command: MSET(data: data)) @@ -659,13 +658,13 @@ extension RedisConnection { /// Atomically modifies the string values of one or more keys only when all keys don't exist. /// - /// - Documentation: [MSETNX](https:/redis.io/docs/latest/commands/msetnx) + /// - Documentation: [MSETNX](https:/valkey.io/commands/msetnx) /// - Version: 1.0.1 /// - Complexity: O(N) where N is the number of keys to set. /// - Categories: @write, @string, @slow /// - Returns: One of the following: - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `0` if no key was set (at least one key already existed). - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `1` if all the keys were set. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `0` if no key was set (at least one key already existed). + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `1` if all the keys were set. @inlinable public func msetnx(data: [MSETNX.Data]) async throws -> Int { try await send(command: MSETNX(data: data)) @@ -673,91 +672,96 @@ extension RedisConnection { /// Sets both string value and expiration time in milliseconds of a key. The key is created if it doesn't exist. /// - /// - Documentation: [PSETEX](https:/redis.io/docs/latest/commands/psetex) + /// - Documentation: [PSETEX](https:/valkey.io/commands/psetex) /// - Version: 2.6.0 /// - Complexity: O(1) /// - Categories: @write, @string, @slow - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable - public func psetex(key: RedisKey, milliseconds: Int, value: String) async throws -> RESPToken { + public func psetex(key: RESPKey, milliseconds: Int, value: String) async throws -> RESPToken { try await send(command: PSETEX(key: key, milliseconds: milliseconds, value: value)) } /// Sets the string value of a key, ignoring its type. The key is created if it doesn't exist. /// - /// - Documentation: [SET](https:/redis.io/docs/latest/commands/set) + /// - Documentation: [SET](https:/valkey.io/commands/set) /// - Version: 1.0.0 /// - Complexity: O(1) /// - Categories: @write, @string, @slow - /// - Returns: Any of the following: - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): `GET` not given: Operation was aborted (conflict with one of the `XX`/`NX` options). - /// * [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. `GET` not given: The key was set. - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): `GET` given: The key didn't exist before the `SET`. - /// * [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): `GET` given: The previous value of the key. + /// - Returns: If `GET` not given, any of the following: + /// * [Null](https:/valkey.io/topics/protocol/#nulls): Operation was aborted (conflict with one of the `XX`/`NX` options). + /// * [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`: The key was set. + /// If `GET` given, any of the following: + /// * [Null](https:/valkey.io/topics/protocol/#nulls): The key didn't exist before the `SET`. + /// * [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): The previous value of the key. + /// Note that when using `GET` together with `XX`/`NX`/`IFEQ`, the reply indirectly indicates whether the key was set: + /// * `GET` and `XX` given: Non-[Null](https:/valkey.io/topics/protocol/#nulls) indicates the key was set. + /// * `GET` and `NX` given: [Null](https:/valkey.io/topics/protocol/#nulls) indicates the key was set. + /// * `GET` and `IFEQ` given: The key was set if the reply is equal to `comparison-value`. @inlinable - public func set(key: RedisKey, value: String, condition: SET.Condition? = nil, get: Bool = false, expiration: SET.Expiration? = nil) async throws -> String? { + public func set(key: RESPKey, value: String, condition: SET.Condition? = nil, get: Bool = false, expiration: SET.Expiration? = nil) async throws -> String? { try await send(command: SET(key: key, value: value, condition: condition, get: get, expiration: expiration)) } /// Sets the string value and expiration time of a key. Creates the key if it doesn't exist. /// - /// - Documentation: [SETEX](https:/redis.io/docs/latest/commands/setex) + /// - Documentation: [SETEX](https:/valkey.io/commands/setex) /// - Version: 2.0.0 /// - Complexity: O(1) /// - Categories: @write, @string, @slow - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable - public func setex(key: RedisKey, seconds: Int, value: String) async throws -> RESPToken { + public func setex(key: RESPKey, seconds: Int, value: String) async throws -> RESPToken { try await send(command: SETEX(key: key, seconds: seconds, value: value)) } /// Set the string value of a key only when the key doesn't exist. /// - /// - Documentation: [SETNX](https:/redis.io/docs/latest/commands/setnx) + /// - Documentation: [SETNX](https:/valkey.io/commands/setnx) /// - Version: 1.0.0 /// - Complexity: O(1) /// - Categories: @write, @string, @fast /// - Returns: One of the following: - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `0` if the key was not set. - /// * [Integer](https:/redis.io/docs/reference/protocol-spec#integers): `1` if the key was set. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `0` if the key was not set. + /// * [Integer](https:/valkey.io/topics/protocol/#integers): `1` if the key was set. @inlinable - public func setnx(key: RedisKey, value: String) async throws -> Int { + public func setnx(key: RESPKey, value: String) async throws -> Int { try await send(command: SETNX(key: key, value: value)) } /// Overwrites a part of a string value with another by an offset. Creates the key if it doesn't exist. /// - /// - Documentation: [SETRANGE](https:/redis.io/docs/latest/commands/setrange) + /// - Documentation: [SETRANGE](https:/valkey.io/commands/setrange) /// - Version: 2.2.0 /// - Complexity: O(1), not counting the time taken to copy the new string in place. Usually, this string is very small so the amortized complexity is O(1). Otherwise, complexity is O(M) with M being the length of the value argument. /// - Categories: @write, @string, @slow - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the length of the string after it was modified by the command. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the length of the string after it was modified by the command. @inlinable - public func setrange(key: RedisKey, offset: Int, value: String) async throws -> Int { + public func setrange(key: RESPKey, offset: Int, value: String) async throws -> Int { try await send(command: SETRANGE(key: key, offset: offset, value: value)) } /// Returns the length of a string value. /// - /// - Documentation: [STRLEN](https:/redis.io/docs/latest/commands/strlen) + /// - Documentation: [STRLEN](https:/valkey.io/commands/strlen) /// - Version: 2.2.0 /// - Complexity: O(1) /// - Categories: @read, @string, @fast - /// - Returns: [Integer](https:/redis.io/docs/reference/protocol-spec#integers): the length of the string stored at key, or 0 when the key does not exist. + /// - Returns: [Integer](https:/valkey.io/topics/protocol/#integers): the length of the string stored at key, or 0 when the key does not exist. @inlinable - public func strlen(key: RedisKey) async throws -> Int { + public func strlen(key: RESPKey) async throws -> Int { try await send(command: STRLEN(key: key)) } /// Returns a substring from a string value. /// - /// - Documentation: [SUBSTR](https:/redis.io/docs/latest/commands/substr) + /// - Documentation: [SUBSTR](https:/valkey.io/commands/substr) /// - Version: 1.0.0 /// - Complexity: O(N) where N is the length of the returned string. The complexity is ultimately determined by the returned length, but because creating a substring from an existing string is very cheap, it can be considered O(1) for small strings. /// - Categories: @read, @string, @slow - /// - Returns: [Bulk string](https:/redis.io/docs/reference/protocol-spec#bulk-strings): the substring of the string value stored at key, determined by the offsets start and end (both are inclusive). + /// - Returns: [Bulk string](https:/valkey.io/topics/protocol/#bulk-strings): the substring of the string value stored at key, determined by the offsets start and end (both are inclusive). @inlinable - public func substr(key: RedisKey, start: Int, end: Int) async throws -> String { + public func substr(key: RESPKey, start: Int, end: Int) async throws -> String { try await send(command: SUBSTR(key: key, start: start, end: end)) } diff --git a/Sources/RedisCommands/TransactionsCommands.swift b/Sources/Valkey/Commands/TransactionsCommands.swift similarity index 56% rename from Sources/RedisCommands/TransactionsCommands.swift rename to Sources/Valkey/Commands/TransactionsCommands.swift index 9898c7ec..ea00e6d3 100644 --- a/Sources/RedisCommands/TransactionsCommands.swift +++ b/Sources/Valkey/Commands/TransactionsCommands.swift @@ -1,21 +1,20 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -// This file is autogenerated by RedisCommandsBuilder +// This file is autogenerated by ValkeyCommandsBuilder import NIOCore -import Redis #if canImport(FoundationEssentials) import FoundationEssentials @@ -24,81 +23,81 @@ import Foundation #endif /// Discards a transaction. -public struct DISCARD: RedisCommand { +public struct DISCARD: RESPCommand { public typealias Response = RESPToken @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("DISCARD") } } /// Executes all commands in a transaction. -public struct EXEC: RedisCommand { +public struct EXEC: RESPCommand { public typealias Response = [RESPToken]? @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("EXEC") } } /// Starts a transaction. -public struct MULTI: RedisCommand { +public struct MULTI: RESPCommand { public typealias Response = RESPToken @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("MULTI") } } /// Forgets about watched keys of a transaction. -public struct UNWATCH: RedisCommand { +public struct UNWATCH: RESPCommand { public typealias Response = RESPToken @inlinable public init() { } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("UNWATCH") } } /// Monitors changes to keys to determine the execution of a transaction. -public struct WATCH: RedisCommand { +public struct WATCH: RESPCommand { public typealias Response = RESPToken - public var key: [RedisKey] + public var key: [RESPKey] - @inlinable public init(key: [RedisKey]) { + @inlinable public init(key: [RESPKey]) { self.key = key } - @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) { + @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("WATCH", key) } } -extension RedisConnection { +extension ValkeyConnection { /// Discards a transaction. /// - /// - Documentation: [DISCARD](https:/redis.io/docs/latest/commands/discard) + /// - Documentation: [DISCARD](https:/valkey.io/commands/discard) /// - Version: 2.0.0 /// - Complexity: O(N), when N is the number of queued commands /// - Categories: @fast, @transaction - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func discard() async throws -> RESPToken { try await send(command: DISCARD()) @@ -106,13 +105,13 @@ extension RedisConnection { /// Executes all commands in a transaction. /// - /// - Documentation: [EXEC](https:/redis.io/docs/latest/commands/exec) + /// - Documentation: [EXEC](https:/valkey.io/commands/exec) /// - Version: 1.2.0 /// - Complexity: Depends on commands in the transaction /// - Categories: @slow, @transaction /// - Returns: One of the following: - /// * [Array](https:/redis.io/docs/reference/protocol-spec#arrays): each element being the reply to each of the commands in the atomic transaction. - /// * [Null](https:/redis.io/docs/reference/protocol-spec#nulls): the transaction was aborted because a `WATCH`ed key was touched. + /// * [Array](https:/valkey.io/topics/protocol/#arrays): each element being the reply to each of the commands in the atomic transaction. + /// * [Null](https:/valkey.io/topics/protocol/#nulls): the transaction was aborted because a `WATCH`ed key was touched. @inlinable public func exec() async throws -> [RESPToken]? { try await send(command: EXEC()) @@ -120,11 +119,11 @@ extension RedisConnection { /// Starts a transaction. /// - /// - Documentation: [MULTI](https:/redis.io/docs/latest/commands/multi) + /// - Documentation: [MULTI](https:/valkey.io/commands/multi) /// - Version: 1.2.0 /// - Complexity: O(1) /// - Categories: @fast, @transaction - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func multi() async throws -> RESPToken { try await send(command: MULTI()) @@ -132,11 +131,11 @@ extension RedisConnection { /// Forgets about watched keys of a transaction. /// - /// - Documentation: [UNWATCH](https:/redis.io/docs/latest/commands/unwatch) + /// - Documentation: [UNWATCH](https:/valkey.io/commands/unwatch) /// - Version: 2.2.0 /// - Complexity: O(1) /// - Categories: @fast, @transaction - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable public func unwatch() async throws -> RESPToken { try await send(command: UNWATCH()) @@ -144,13 +143,13 @@ extension RedisConnection { /// Monitors changes to keys to determine the execution of a transaction. /// - /// - Documentation: [WATCH](https:/redis.io/docs/latest/commands/watch) + /// - Documentation: [WATCH](https:/valkey.io/commands/watch) /// - Version: 2.2.0 /// - Complexity: O(1) for every key. /// - Categories: @fast, @transaction - /// - Returns: [Simple string](https:/redis.io/docs/reference/protocol-spec#simple-strings): `OK`. + /// - Returns: [Simple string](https:/valkey.io/topics/protocol/#simple-strings): `OK`. @inlinable - public func watch(key: [RedisKey]) async throws -> RESPToken { + public func watch(key: [RESPKey]) async throws -> RESPToken { try await send(command: WATCH(key: key)) } diff --git a/Sources/Redis/Connection/RedisConnection.swift b/Sources/Valkey/Connection/ValkeyConnection.swift similarity index 89% rename from Sources/Redis/Connection/RedisConnection.swift rename to Sources/Valkey/Connection/ValkeyConnection.swift index 1aab45ca..e96b9c13 100644 --- a/Sources/Redis/Connection/RedisConnection.swift +++ b/Sources/Valkey/Connection/ValkeyConnection.swift @@ -1,12 +1,12 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis project +// This source file is part of the swift-valkey project // -// Copyright (c) 2024 the swift-redis authors +// Copyright (c) 2024 the swift-valkey authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See swift-redis/CONTRIBUTORS.txt for the list of swift-redis authors +// See swift-valkey/CONTRIBUTORS.txt for the list of swift-valkey authors // // SPDX-License-Identifier: Apache-2.0 // @@ -40,9 +40,8 @@ public struct ServerAddress: Sendable, Equatable { public static func unixDomainSocket(path: String) -> Self { .init(.unixDomainSocket(path: path)) } } -/// Single connection to a Redis database -@_documentation(visibility: internal) -public struct RedisConnection: Sendable { +/// Single connection to a Valkey database +public struct ValkeyConnection: Sendable { enum Request { case command(ByteBuffer) case pipelinedCommands(ByteBuffer, Int) @@ -55,7 +54,7 @@ public struct RedisConnection: Sendable { /// Logger used by Server let logger: Logger let eventLoopGroup: EventLoopGroup - let configuration: RedisClientConfiguration + let configuration: ValkeyClientConfiguration let address: ServerAddress #if canImport(Network) let tlsOptions: NWProtocolTLS.Options? @@ -67,7 +66,7 @@ public struct RedisConnection: Sendable { /// Initialize Client public init( address: ServerAddress, - configuration: RedisClientConfiguration, + configuration: ValkeyClientConfiguration, eventLoopGroup: EventLoopGroup = MultiThreadedEventLoopGroup.singleton, logger: Logger ) { @@ -103,9 +102,9 @@ public struct RedisConnection: Sendable { } else { requestContinuation.finish() continuation.resume( - throwing: RedisClientError( + throwing: ValkeyClientError( .connectionClosed, - message: "The connection to the Redis database was unexpectedly closed." + message: "The connection to the database was unexpectedly closed." ) ) } @@ -120,9 +119,9 @@ public struct RedisConnection: Sendable { } else { requestContinuation.finish() continuation.resume( - throwing: RedisClientError( + throwing: ValkeyClientError( .connectionClosed, - message: "The connection to the Redis database was unexpectedly closed." + message: "The connection to the database was unexpectedly closed." ) ) return @@ -136,9 +135,9 @@ public struct RedisConnection: Sendable { } catch { requestContinuation.finish() continuation.resume( - throwing: RedisClientError( + throwing: ValkeyClientError( .connectionClosed, - message: "The connection to the Redis database has shut down while processing a request." + message: "The connection to the database has shut down while processing a request." ) ) } @@ -157,8 +156,8 @@ public struct RedisConnection: Sendable { } } - @discardableResult public func send(command: Command) async throws -> Command.Response { - var encoder = RedisCommandEncoder() + @discardableResult public func send(command: Command) async throws -> Command.Response { + var encoder = RESPCommandEncoder() command.encode(into: &encoder) let response: Response = try await withCheckedThrowingContinuation { continuation in switch requestContinuation.yield((.command(encoder.buffer), continuation)) { @@ -166,7 +165,7 @@ public struct RedisConnection: Sendable { break case .dropped, .terminated: continuation.resume( - throwing: RedisClientError( + throwing: ValkeyClientError( .connectionClosed, message: "Unable to enqueue request due to the connection being shutdown." ) @@ -179,11 +178,11 @@ public struct RedisConnection: Sendable { return try .init(from: token) } - @discardableResult public func pipeline( + @discardableResult public func pipeline( _ commands: repeat each Command ) async throws -> (repeat (each Command).Response) { var count = 0 - var encoder = RedisCommandEncoder() + var encoder = RESPCommandEncoder() for command in repeat each commands { command.encode(into: &encoder) count += 1 @@ -195,7 +194,7 @@ public struct RedisConnection: Sendable { break case .dropped, .terminated: continuation.resume( - throwing: RedisClientError( + throwing: ValkeyClientError( .connectionClosed, message: "Unable to enqueue request due to the connection being shutdown." ) @@ -215,16 +214,16 @@ public struct RedisConnection: Sendable { outbound: NIOAsyncChannelOutboundWriter, inboundIterator: inout NIOAsyncChannelInboundStream.AsyncIterator ) async throws { - var encoder = RedisCommandEncoder() + var encoder = RESPCommandEncoder() encoder.encodeArray("HELLO", 3) try await outbound.write(encoder.buffer) let response = try await inboundIterator.next() guard let response else { - throw RedisClientError(.connectionClosed, message: "The connection to the Redis database was unexpectedly closed.") + throw ValkeyClientError(.connectionClosed, message: "The connection to the database was unexpectedly closed.") } // if returned value is an error then throw that error if let value = response.errorString { - throw RedisClientError(.commandError, message: String(buffer: value)) + throw ValkeyClientError(.commandError, message: String(buffer: value)) } } diff --git a/Sources/Redis/RedisCommand.swift b/Sources/Valkey/RESP/RESPCommand.swift similarity index 52% rename from Sources/Redis/RedisCommand.swift rename to Sources/Valkey/RESP/RESPCommand.swift index adc8297a..78eeaf92 100644 --- a/Sources/Redis/RedisCommand.swift +++ b/Sources/Valkey/RESP/RESPCommand.swift @@ -1,12 +1,12 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // @@ -14,9 +14,9 @@ import NIOCore -/// A redis command that can be executed on a connection. -public protocol RedisCommand { +/// A RESP command that can be executed on a connection. +public protocol RESPCommand { associatedtype Response: RESPTokenRepresentable = RESPToken - func encode(into commandEncoder: inout RedisCommandEncoder) + func encode(into commandEncoder: inout RESPCommandEncoder) } diff --git a/Sources/Redis/RedisCommandEncoder.swift b/Sources/Valkey/RESP/RESPCommandEncoder.swift similarity index 90% rename from Sources/Redis/RedisCommandEncoder.swift rename to Sources/Valkey/RESP/RESPCommandEncoder.swift index d7dc0443..a08030a1 100644 --- a/Sources/Redis/RedisCommandEncoder.swift +++ b/Sources/Valkey/RESP/RESPCommandEncoder.swift @@ -1,12 +1,12 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // @@ -14,7 +14,7 @@ import NIOCore -public struct RedisCommandEncoder { +public struct RESPCommandEncoder { @usableFromInline var buffer: ByteBuffer diff --git a/Sources/Redis/RESP/RESPError.swift b/Sources/Valkey/RESP/RESPError.swift similarity index 93% rename from Sources/Redis/RESP/RESPError.swift rename to Sources/Valkey/RESP/RESPError.swift index 3c13180c..281a1fe1 100644 --- a/Sources/Redis/RESP/RESPError.swift +++ b/Sources/Valkey/RESP/RESPError.swift @@ -1,12 +1,12 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the RediStack open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the RediStack project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of RediStack project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/Sources/Redis/RedisKey.swift b/Sources/Valkey/RESP/RESPKey.swift similarity index 57% rename from Sources/Redis/RedisKey.swift rename to Sources/Valkey/RESP/RESPKey.swift index c97403af..f20f6d60 100644 --- a/Sources/Redis/RedisKey.swift +++ b/Sources/Valkey/RESP/RESPKey.swift @@ -1,12 +1,12 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // @@ -14,8 +14,8 @@ import NIOCore -/// Type representing a RedisKey -public struct RedisKey: RawRepresentable { +/// Type representing a RESPKey +public struct RESPKey: RawRepresentable { public var rawValue: String public init(rawValue: String) { @@ -23,7 +23,7 @@ public struct RedisKey: RawRepresentable { } } -extension RedisKey: RESPTokenRepresentable { +extension RESPKey: RESPTokenRepresentable { public init(from token: RESPToken) throws { switch token.value { case .simpleString(let buffer), .bulkString(let buffer): @@ -34,13 +34,20 @@ extension RedisKey: RESPTokenRepresentable { } } -extension RedisKey: CustomStringConvertible { +extension RESPKey: CustomStringConvertible { public var description: String { rawValue.description } } -extension RedisKey: RESPRenderable { +extension RESPKey: RESPRenderable { @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { self.rawValue.encode(into: &commandEncoder) } } + +extension RESPKey: ExpressibleByStringLiteral { + @inlinable + public init(stringLiteral string: String) { + self.init(rawValue: string) + } +} diff --git a/Sources/Redis/RESP/RESPRenderable.swift b/Sources/Valkey/RESP/RESPRenderable.swift similarity index 65% rename from Sources/Redis/RESP/RESPRenderable.swift rename to Sources/Valkey/RESP/RESPRenderable.swift index a737e30c..6054692f 100644 --- a/Sources/Redis/RESP/RESPRenderable.swift +++ b/Sources/Valkey/RESP/RESPRenderable.swift @@ -1,12 +1,12 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // @@ -16,12 +16,12 @@ import NIOCore /// Type that can be rendered into a RESP buffer public protocol RESPRenderable { - func encode(into commandEncoder: inout RedisCommandEncoder) -> Int + func encode(into commandEncoder: inout RESPCommandEncoder) -> Int } extension Optional: RESPRenderable where Wrapped: RESPRenderable { @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { switch self { case .some(let wrapped): return wrapped.encode(into: &commandEncoder) @@ -33,7 +33,7 @@ extension Optional: RESPRenderable where Wrapped: RESPRenderable { extension Array: RESPRenderable where Element: RESPRenderable { @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { var count = 0 for element in self { count += element.encode(into: &commandEncoder) @@ -44,7 +44,7 @@ extension Array: RESPRenderable where Element: RESPRenderable { extension String: RESPRenderable { @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { commandEncoder.encodeBulkString(self) return 1 } @@ -52,7 +52,7 @@ extension String: RESPRenderable { extension Int: RESPRenderable { @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { commandEncoder.encodeBulkString(String(self)) return 1 } @@ -60,7 +60,7 @@ extension Int: RESPRenderable { extension Double: RESPRenderable { @inlinable - public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { commandEncoder.encodeBulkString(String(self)) return 1 } diff --git a/Sources/Redis/RedisRenderableHelpers.swift b/Sources/Valkey/RESP/RESPRenderableHelpers.swift similarity index 78% rename from Sources/Redis/RedisRenderableHelpers.swift rename to Sources/Valkey/RESP/RESPRenderableHelpers.swift index 0bc6133b..a1309ed7 100644 --- a/Sources/Redis/RedisRenderableHelpers.swift +++ b/Sources/Valkey/RESP/RESPRenderableHelpers.swift @@ -1,12 +1,12 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // @@ -15,7 +15,7 @@ import NIOCore @usableFromInline -package struct RedisPureToken: RESPRenderable { +package struct RESPPureToken: RESPRenderable { @usableFromInline let token: String? @inlinable @@ -27,7 +27,7 @@ package struct RedisPureToken: RESPRenderable { } } @inlinable - package func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + package func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { self.token.encode(into: &commandEncoder) } } @@ -45,7 +45,7 @@ package struct RESPWithToken: RESPRenderable { self.token = token } @inlinable - package func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + package func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { if let value { let writerIndex = commandEncoder.writerIndex _ = self.token.encode(into: &commandEncoder) @@ -71,7 +71,7 @@ package struct RESPArrayWithCount: RESPRenderable { self.array = array } @inlinable - package func encode(into commandEncoder: inout RedisCommandEncoder) -> Int { + package func encode(into commandEncoder: inout RESPCommandEncoder) -> Int { _ = array.count.encode(into: &commandEncoder) let count = array.encode(into: &commandEncoder) return count + 1 diff --git a/Sources/Redis/RESP/RESPToken.swift b/Sources/Valkey/RESP/RESPToken.swift similarity index 98% rename from Sources/Redis/RESP/RESPToken.swift rename to Sources/Valkey/RESP/RESPToken.swift index 563e6d9f..94b382f3 100644 --- a/Sources/Redis/RESP/RESPToken.swift +++ b/Sources/Valkey/RESP/RESPToken.swift @@ -1,12 +1,12 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the RediStack open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the RediStack project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of RediStack project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/Sources/Redis/RESP/RESPTokenDecoder.swift b/Sources/Valkey/RESP/RESPTokenDecoder.swift similarity index 77% rename from Sources/Redis/RESP/RESPTokenDecoder.swift rename to Sources/Valkey/RESP/RESPTokenDecoder.swift index b0fbd82a..1ab3690c 100644 --- a/Sources/Redis/RESP/RESPTokenDecoder.swift +++ b/Sources/Valkey/RESP/RESPTokenDecoder.swift @@ -1,12 +1,12 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the RediStack open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the RediStack project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of RediStack project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/Sources/Redis/RESP/RESPTokenRepresentable.swift b/Sources/Valkey/RESP/RESPTokenRepresentable.swift similarity index 94% rename from Sources/Redis/RESP/RESPTokenRepresentable.swift rename to Sources/Valkey/RESP/RESPTokenRepresentable.swift index 14a1363f..3380f6dd 100644 --- a/Sources/Redis/RESP/RESPTokenRepresentable.swift +++ b/Sources/Valkey/RESP/RESPTokenRepresentable.swift @@ -1,12 +1,12 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // @@ -22,7 +22,7 @@ public protocol RESPTokenRepresentable { extension RESPToken: RESPTokenRepresentable { /// Convert RESP3Token to a value /// - Parameter type: Type to convert to - /// - Throws: RedisClientError.unexpectedType + /// - Throws: ValkeyClientError.unexpectedType /// - Returns: Value @inlinable public func converting(to type: Value.Type = Value.self) throws -> Value { @@ -38,7 +38,7 @@ extension RESPToken: RESPTokenRepresentable { extension Array where Element == RESPToken { /// Convert RESP3Token Array to a value array /// - Parameter type: Type to convert to - /// - Throws: RedisClientError.unexpectedType + /// - Throws: ValkeyClientError.unexpectedType /// - Returns: Array of Value @inlinable public func converting(to type: [Value].Type = [Value].self) throws -> [Value] { diff --git a/Sources/Redis/RESP/RESPTypeIdentifier.swift b/Sources/Valkey/RESP/RESPTypeIdentifier.swift similarity index 85% rename from Sources/Redis/RESP/RESPTypeIdentifier.swift rename to Sources/Valkey/RESP/RESPTypeIdentifier.swift index 40d3f2cd..0b45ea22 100644 --- a/Sources/Redis/RESP/RESPTypeIdentifier.swift +++ b/Sources/Valkey/RESP/RESPTypeIdentifier.swift @@ -1,12 +1,12 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the RediStack open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the RediStack project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of RediStack project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // diff --git a/Sources/Redis/RedisClient.swift b/Sources/Valkey/ValkeyClient.swift similarity index 64% rename from Sources/Redis/RedisClient.swift rename to Sources/Valkey/ValkeyClient.swift index 7402d948..fe363734 100644 --- a/Sources/Redis/RedisClient.swift +++ b/Sources/Valkey/ValkeyClient.swift @@ -1,12 +1,12 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // @@ -18,32 +18,32 @@ import NIOPosix import NIOSSL import NIOTransportServices -/// Redis client +/// Valkey client /// -/// Connect to redis server. +/// Connect to Valkey server. /// /// Supports TLS via both NIOSSL and Network framework. -public struct RedisClient { +public struct ValkeyClient { /// Server address let serverAddress: ServerAddress /// configuration - let configuration: RedisClientConfiguration + let configuration: ValkeyClientConfiguration /// EventLoopGroup to use let eventLoopGroup: EventLoopGroup /// Logger let logger: Logger - /// Initialize Redis client + /// Initialize Valkey client /// /// - Parametes: - /// - address: Redis database address - /// - configuration: Redis client configuration - /// - tlsConfiguration: Redis TLS connection configuration + /// - address: Valkey database address + /// - configuration: Valkey client configuration + /// - tlsConfiguration: Valkey TLS connection configuration /// - eventLoopGroup: EventLoopGroup to run WebSocket client on /// - logger: Logger public init( _ address: ServerAddress, - configuration: RedisClientConfiguration = .init(), + configuration: ValkeyClientConfiguration = .init(), eventLoopGroup: EventLoopGroup = MultiThreadedEventLoopGroup.singleton, logger: Logger ) { @@ -54,17 +54,17 @@ public struct RedisClient { } } -extension RedisClient { +extension ValkeyClient { /// Create connection and run operation using connection /// /// - Parameters: /// - logger: Logger - /// - operation: Closure handling redis connection + /// - operation: Closure handling Valkey connection public func withConnection( logger: Logger, - operation: @escaping @Sendable (RedisConnection) async throws -> Value + operation: @escaping @Sendable (ValkeyConnection) async throws -> Value ) async throws -> Value { - let redisConnection = RedisConnection( + let valkeyConnection = ValkeyConnection( address: self.serverAddress, configuration: self.configuration, eventLoopGroup: self.eventLoopGroup, @@ -72,9 +72,9 @@ extension RedisClient { ) return try await withThrowingTaskGroup(of: Void.self) { group in group.addTask { - try await redisConnection.run() + try await valkeyConnection.run() } - let value: Value = try await operation(redisConnection) + let value: Value = try await operation(valkeyConnection) group.cancelAll() return value } diff --git a/Sources/Redis/RedisClientConfiguration.swift b/Sources/Valkey/ValkeyClientConfiguration.swift similarity index 80% rename from Sources/Redis/RedisClientConfiguration.swift rename to Sources/Valkey/ValkeyClientConfiguration.swift index bb9dca1d..77742f59 100644 --- a/Sources/Redis/RedisClientConfiguration.swift +++ b/Sources/Valkey/ValkeyClientConfiguration.swift @@ -1,12 +1,12 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // @@ -14,8 +14,8 @@ import NIOSSL -/// Configuration for the redis client -public struct RedisClientConfiguration: Sendable { +/// Configuration for the Valkey client +public struct ValkeyClientConfiguration: Sendable { public struct RESPVersion: Sendable, Equatable { enum Base { case v2 @@ -43,7 +43,7 @@ public struct RedisClientConfiguration: Sendable { public var respVersion: RESPVersion public var tls: TLS - /// Initialize RedisClientConfiguration + /// Initialize ValkeyClientConfiguration /// - Parameters /// - respVersion: RESP version to use /// - tlsConfiguration: TLS configuration diff --git a/Sources/Redis/RedisClientError.swift b/Sources/Valkey/ValkeyClientError.swift similarity index 73% rename from Sources/Redis/RedisClientError.swift rename to Sources/Valkey/ValkeyClientError.swift index bfc7bb7d..4ca6a74a 100644 --- a/Sources/Redis/RedisClientError.swift +++ b/Sources/Valkey/ValkeyClientError.swift @@ -1,19 +1,19 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -/// Errors returned by ``RedisClient`` -public struct RedisClientError: Error, CustomStringConvertible { +/// Errors returned by ``ValkeyClient`` +public struct ValkeyClientError: Error, CustomStringConvertible { public struct ErrorCode: Equatable, Sendable { fileprivate enum _Internal: Equatable, Sendable { case connectionClosed @@ -27,7 +27,7 @@ public struct RedisClientError: Error, CustomStringConvertible { /// Provided URL is invalid public static var connectionClosed: Self { .init(.connectionClosed) } - /// Error returned by redis command + /// Error returned by Valkey command public static var commandError: Self { .init(.commandError) } } @@ -41,7 +41,7 @@ public struct RedisClientError: Error, CustomStringConvertible { public var description: String { switch self.errorCode.value { case .connectionClosed: "Connection has been closed" - case .commandError: self.message ?? "Redis command returned an error" + case .commandError: self.message ?? "Valkey command returned an error" } } } diff --git a/Sources/RedisCommandsBuilder/Resources/commands.json b/Sources/ValkeyCommandsBuilder/Resources/commands.json similarity index 99% rename from Sources/RedisCommandsBuilder/Resources/commands.json rename to Sources/ValkeyCommandsBuilder/Resources/commands.json index 82f66118..86d04445 100644 --- a/Sources/RedisCommandsBuilder/Resources/commands.json +++ b/Sources/ValkeyCommandsBuilder/Resources/commands.json @@ -356,7 +356,7 @@ "summary": "Appends a string to the value of a key. Creates the key if it doesn't exist.", "since": "2.0.0", "group": "string", - "complexity": "O(1). The amortized time complexity is O(1) assuming the appended value is small and the already present value is of any size, since the dynamic string library used by Redis will double the free space available on every reallocation.", + "complexity": "O(1). The amortized time complexity is O(1) assuming the appended value is small and the already present value is of any size, since the dynamic string library used by Valkey will double the free space available on every reallocation.", "acl_categories": [ "@write", "@string", @@ -2375,7 +2375,7 @@ ] }, "CLUSTER": { - "summary": "A container for Redis Cluster commands.", + "summary": "A container for Valkey Cluster commands.", "since": "3.0.0", "group": "cluster", "complexity": "Depends on subcommand.", @@ -3099,7 +3099,7 @@ "summary": "Returns detailed information about all commands.", "since": "2.8.13", "group": "server", - "complexity": "O(N) where N is the total number of Redis commands", + "complexity": "O(N) where N is the total number of Valkey commands", "acl_categories": [ "@slow", "@connection" @@ -3265,7 +3265,7 @@ "summary": "Returns a list of command names.", "since": "7.0.0", "group": "server", - "complexity": "O(N) where N is the total number of Redis commands", + "complexity": "O(N) where N is the total number of Valkey commands", "acl_categories": [ "@slow", "@connection" @@ -3744,7 +3744,7 @@ "summary": "Returns a serialized representation of the value stored at a key.", "since": "2.6.0", "group": "generic", - "complexity": "O(1) to access the key and additional O(N*M) to serialize it, where N is the number of Redis objects composing the value and M their average size. For small string values the time complexity is thus O(1)+O(1*M) where M is small, so simply O(1).", + "complexity": "O(1) to access the key and additional O(N*M) to serialize it, where N is the number of Valkey objects composing the value and M their average size. For small string values the time complexity is thus O(1)+O(1*M) where M is small, so simply O(1).", "acl_categories": [ "@keyspace", "@read", @@ -6825,7 +6825,7 @@ ] }, "HELLO": { - "summary": "Handshakes with the Redis server.", + "summary": "Handshakes with the Valkey server.", "since": "6.0.0", "group": "connection", "complexity": "O(1)", @@ -8541,7 +8541,7 @@ ] }, "LOLWUT": { - "summary": "Displays computer art and the Redis version", + "summary": "Displays computer art and the Valkey version", "since": "5.0.0", "group": "server", "acl_categories": [ @@ -9197,7 +9197,7 @@ ] }, "MIGRATE": { - "summary": "Atomically transfers a key from one Redis instance to another.", + "summary": "Atomically transfers a key from one Valkey instance to another.", "since": "2.6.0", "group": "generic", "complexity": "This command actually executes a DUMP+DEL in the source instance, and a RESTORE in the target instance. See the pages of these commands for time complexity. Also an O(N) data transfer between the two instances is performed.", @@ -9736,7 +9736,7 @@ "arity": -2 }, "OBJECT ENCODING": { - "summary": "Returns the internal encoding of a Redis object.", + "summary": "Returns the internal encoding of a Valkey object.", "since": "2.2.3", "group": "generic", "complexity": "O(1)", @@ -9781,7 +9781,7 @@ ] }, "OBJECT FREQ": { - "summary": "Returns the logarithmic access frequency counter of a Redis object.", + "summary": "Returns the logarithmic access frequency counter of a Valkey object.", "since": "4.0.0", "group": "generic", "complexity": "O(1)", @@ -9841,7 +9841,7 @@ ] }, "OBJECT IDLETIME": { - "summary": "Returns the time since the last access to a Redis object.", + "summary": "Returns the time since the last access to a Valkey object.", "since": "2.2.3", "group": "generic", "complexity": "O(1)", @@ -10864,7 +10864,7 @@ ] }, "READONLY": { - "summary": "Enables read-only queries for a connection to a Redis Cluster replica node.", + "summary": "Enables read-only queries for a connection to a Valkey Cluster replica node.", "since": "3.0.0", "group": "cluster", "complexity": "O(1)", @@ -11143,7 +11143,7 @@ "summary": "Creates a key from the serialized representation of a value.", "since": "2.6.0", "group": "generic", - "complexity": "O(1) to create the new key and additional O(N*M) to reconstruct the serialized value, where N is the number of Redis objects composing the value and M their average size. For small string values the time complexity is thus O(1)+O(1*M) where M is small, so simply O(1). However for sorted set values the complexity is O(N*M*log(N)) because inserting values into sorted sets is O(log(N)).", + "complexity": "O(1) to create the new key and additional O(N*M) to reconstruct the serialized value, where N is the number of Valkey objects composing the value and M their average size. For small string values the time complexity is thus O(1)+O(1*M) where M is small, so simply O(1). However for sorted set values the complexity is O(N*M*log(N)) because inserting values into sorted sets is O(log(N)).", "history": [ [ "3.0.0", @@ -11244,7 +11244,7 @@ "summary": "An internal command for migrating keys in a cluster.", "since": "3.0.0", "group": "server", - "complexity": "O(1) to create the new key and additional O(N*M) to reconstruct the serialized value, where N is the number of Redis objects composing the value and M their average size. For small string values the time complexity is thus O(1)+O(1*M) where M is small, so simply O(1). However for sorted set values the complexity is O(N*M*log(N)) because inserting values into sorted sets is O(log(N)).", + "complexity": "O(1) to create the new key and additional O(N*M) to reconstruct the serialized value, where N is the number of Valkey objects composing the value and M their average size. For small string values the time complexity is thus O(1)+O(1*M) where M is small, so simply O(1). However for sorted set values the complexity is O(N*M*log(N)) because inserting values into sorted sets is O(log(N)).", "history": [ [ "3.0.0", @@ -12467,7 +12467,7 @@ ] }, "SHUTDOWN": { - "summary": "Synchronously saves the database(s) to disk and shuts down the Redis server.", + "summary": "Synchronously saves the database(s) to disk and shuts down the Valkey server.", "since": "1.0.0", "group": "server", "complexity": "O(N) when saving, where N is the total number of keys in all databases when saving data, otherwise O(1)", @@ -12759,7 +12759,7 @@ ] }, "SLAVEOF": { - "summary": "Sets a Redis server as a replica of another, or promotes it to being a master.", + "summary": "Sets a Valkey server as a replica of another, or promotes it to being a master.", "since": "1.0.0", "group": "server", "complexity": "O(1)", @@ -13982,7 +13982,7 @@ ] }, "SWAPDB": { - "summary": "Swaps two Redis databases.", + "summary": "Swaps two Valkey databases.", "since": "4.0.0", "group": "server", "complexity": "O(N) where N is the count of clients watching or blocking on keys from both databases.", diff --git a/Sources/ValkeyCommandsBuilder/Resources/resp3_replies.json b/Sources/ValkeyCommandsBuilder/Resources/resp3_replies.json new file mode 100644 index 00000000..caec4dfc --- /dev/null +++ b/Sources/ValkeyCommandsBuilder/Resources/resp3_replies.json @@ -0,0 +1,1404 @@ +{ + "ACL": [], + "ACL CAT": [ + "One of the following:", + "* [Array reply](../topics/protocol.md#arrays): an array of [Bulk string reply](../topics/protocol.md#bulk-strings) elements representing ACL categories or commands in a given category.", + "* [Simple error reply](../topics/protocol.md#simple-errors): the command returns an error if an invalid category name is given." + ], + "ACL DELUSER": [ + "[Integer reply](../topics/protocol.md#integers): the number of users that were deleted. This number will not always match the number of arguments since certain users may not exist." + ], + "ACL DRYRUN": [ + "Any of the following:", + "* [Simple string reply](../topics/protocol.md#simple-strings): `OK` on success.", + "* [Bulk string reply](../topics/protocol.md#bulk-strings): an error describing why the user can't execute the command." + ], + "ACL GENPASS": [ + "[Bulk string reply](../topics/protocol.md#bulk-strings): pseudorandom data. By default it contains 64 bytes, representing 256 bits of data. If `bits` was given, the output string length is the number of specified bits (rounded to the next multiple of 4) divided by 4." + ], + "ACL GETUSER": [ + "One of the following:", + "* [Map reply](../topics/protocol.md#maps): a set of ACL rule definitions for the user", + "* [Null reply](../topics/protocol.md#nulls): if user does not exist." + ], + "ACL HELP": [ + "[Array reply](../topics/protocol.md#arrays): a list of subcommands and their descriptions." + ], + "ACL LIST": [ + "[Array reply](../topics/protocol.md#arrays): an array of [Bulk string reply](../topics/protocol.md#bulk-strings) elements." + ], + "ACL LOAD": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK` on success.", + "", + "The command may fail with an error for several reasons: if the file is not readable, if there is an error inside the file, and in such cases, the error will be reported to the user in the error.", + "Finally, the command will fail if the server is not configured to use an external ACL file." + ], + "ACL LOG": [ + "When called to show security events:", + "* [Array reply](../topics/protocol.md#arrays): an array of [Bulk string reply](../topics/protocol.md#bulk-strings) elements representing ACL security events.", + "When called with `RESET`:", + "* [Simple string reply](../topics/protocol.md#simple-strings): `OK` if the security log was cleared." + ], + "ACL SAVE": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`.", + "The command may fail with an error for several reasons: if the file cannot be written or if the server is not configured to use an external ACL file." + ], + "ACL SETUSER": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`.", + "If the rules contain errors, the error is returned." + ], + "ACL USERS": [ + "[Array reply](../topics/protocol.md#arrays): list of existing ACL users." + ], + "ACL WHOAMI": [ + "[Bulk string reply](../topics/protocol.md#bulk-strings): the username of the current connection." + ], + "APPEND": [ + "[Integer reply](../topics/protocol.md#integers): the length of the string after the append operation." + ], + "ASKING": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "AUTH": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`, or an error if the password, or username/password pair, is invalid." + ], + "BGREWRITEAOF": [ + "[Bulk string reply](../topics/protocol.md#bulk-strings): a simple string reply indicating that the rewriting started or is about to start ASAP when the call is executed with success.", + "", + "The command may reply with an error in certain cases, as documented above." + ], + "BGSAVE": [ + "One of the following:", + "* [Simple string reply](../topics/protocol.md#simple-strings): `Background saving started`.", + "* [Simple string reply](../topics/protocol.md#simple-strings): `Background saving scheduled`." + ], + "BITCOUNT": [ + "[Integer reply](../topics/protocol.md#integers): the number of bits set to 1." + ], + "BITFIELD": [ + "One of the following:", + "* [Array reply](../topics/protocol.md#arrays): each entry being the corresponding result of the sub-command given at the same position.", + "* [Null reply](../topics/protocol.md#nulls): if OVERFLOW FAIL was given and overflows or underflows are detected." + ], + "BITFIELD_RO": [ + "[Array reply](../topics/protocol.md#arrays): each entry being the corresponding result of the sub-command given at the same position." + ], + "BITOP": [ + "[Integer reply](../topics/protocol.md#integers): the size of the string stored in the destination key is equal to the size of the longest input string." + ], + "BITPOS": [ + "One of the following:", + "* [Integer reply](../topics/protocol.md#integers): the position of the first bit set to 1 or 0 according to the request", + "* [Integer reply](../topics/protocol.md#integers): `-1`. In case the `bit` argument is 1 and the string is empty or composed of just zero bytes", + "", + "If we look for set bits (the bit argument is 1) and the string is empty or composed of just zero bytes, -1 is returned.", + "", + "If we look for clear bits (the bit argument is 0) and the string only contains bits set to 1, the function returns the first bit not part of the string on the right. So if the string is three bytes set to the value `0xff` the command `BITPOS key 0` will return 24, since up to bit 23 all the bits are 1.", + "", + "The function considers the right of the string as padded with zeros if you look for clear bits and specify no range or the _start_ argument **only**.", + "", + "However, this behavior changes if you are looking for clear bits and specify a range with both _start_ and _end_.", + "If a clear bit isn't found in the specified range, the function returns -1 as the user specified a clear range and there are no 0 bits in that range." + ], + "BLMOVE": [ + "One of the following:", + "* [Bulk string reply](../topics/protocol.md#bulk-strings): the element being popped from the _source_ and pushed to the _destination_.", + "* [Null reply](../topics/protocol.md#nulls): the operation timed-out" + ], + "BLMPOP": [ + "One of the following:", + "* [Null reply](../topics/protocol.md#nulls): when no element could be popped and the _timeout_ is reached.", + "* [Array reply](../topics/protocol.md#arrays): a two-element array with the first element being the name of the key from which elements were popped, and the second element being an array of the popped elements." + ], + "BLPOP": [ + "One of the following:", + "* [Null reply](../topics/protocol.md#nulls): no element could be popped and the timeout expired", + "* [Array reply](../topics/protocol.md#arrays): the key from which the element was popped and the value of the popped element." + ], + "BRPOP": [ + "One of the following:", + "* [Null reply](../topics/protocol.md#nulls): no element could be popped and the timeout expired.", + "* [Array reply](../topics/protocol.md#arrays): the key from which the element was popped and the value of the popped element" + ], + "BRPOPLPUSH": [ + "One of the following:", + "* [Bulk string reply](../topics/protocol.md#bulk-strings): the element being popped from _source_ and pushed to _destination_.", + "* [Null reply](../topics/protocol.md#nulls): the timeout is reached." + ], + "BZMPOP": [ + "One of the following:", + "* [Null reply](../topics/protocol.md#nulls): when no element could be popped.", + "* [Array reply](../topics/protocol.md#arrays): a two-element array with the first element being the name of the key from which elements were popped, and the second element is an array of the popped elements. Every entry in the elements array is also an array that contains the member and its score." + ], + "BZPOPMAX": [ + "One of the following:", + "* [Null reply](../topics/protocol.md#nulls): when no element could be popped and the _timeout_ expired.", + "* [Array reply](../topics/protocol.md#arrays): the keyname, popped member, and its score." + ], + "BZPOPMIN": [ + "One of the following:", + "* [Null reply](../topics/protocol.md#nulls): when no element could be popped and the _timeout_ expired.", + "* [Array reply](../topics/protocol.md#arrays): the keyname, popped member, and its score." + ], + "CLIENT": [], + "CLIENT CACHING": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK` or an error if the argument is not \"yes\" or \"no\"." + ], + "CLIENT CAPA": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "CLIENT GETNAME": [ + "One of the following:", + "* [Bulk string reply](../topics/protocol.md#bulk-strings): the connection name of the current connection.", + "* [Null reply](../topics/protocol.md#nulls): the connection name was not set." + ], + "CLIENT GETREDIR": [ + "One of the following:", + "* [Integer reply](../topics/protocol.md#integers): `0` when not redirecting notifications to any client.", + "* [Integer reply](../topics/protocol.md#integers): `-1` if client tracking is not enabled.", + "* [Integer reply](../topics/protocol.md#integers): the ID of the client to which notification are being redirected." + ], + "CLIENT HELP": [ + "[Array reply](../topics/protocol.md#arrays): a list of subcommands and their descriptions." + ], + "CLIENT ID": [ + "[Integer reply](../topics/protocol.md#integers): the ID of the client." + ], + "CLIENT INFO": [ + "[Bulk string reply](../topics/protocol.md#bulk-strings): a unique string for the current client, as described at the `CLIENT LIST` page." + ], + "CLIENT IMPORT-SOURCE": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "CLIENT KILL": [ + "One of the following:", + "* [Simple string reply](../topics/protocol.md#simple-strings): `OK` when called in 3 argument format and the connection has been closed.", + "* [Integer reply](../topics/protocol.md#integers): when called in filter/value format, the number of clients killed." + ], + "CLIENT LIST": [ + "[Bulk string reply](../topics/protocol.md#bulk-strings): information and statistics about client connections." + ], + "CLIENT NO-EVICT": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "CLIENT NO-TOUCH": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "CLIENT PAUSE": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK` or an error if the timeout is invalid." + ], + "CLIENT REPLY": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK` when called with `ON`. When called with either `OFF` or `SKIP` sub-commands, no reply is made." + ], + "CLIENT SETINFO": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK` if the attribute name was successfully set." + ], + "CLIENT SETNAME": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK` if the connection name was successfully set." + ], + "CLIENT TRACKING": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK` if the connection was successfully put in tracking mode or if the tracking mode was successfully disabled. Otherwise, an error is returned." + ], + "CLIENT TRACKINGINFO": [ + "[Map reply](../topics/protocol.md#maps): a list of tracking information sections and their respective values." + ], + "CLIENT UNBLOCK": [ + "One of the following:", + "* [Integer reply](../topics/protocol.md#integers): `0` if the client was unblocked successfully.", + "* [Integer reply](../topics/protocol.md#integers): `1` if the client wasn't unblocked." + ], + "CLIENT UNPAUSE": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "CLUSTER": [], + "CLUSTER ADDSLOTS": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK` if the command was successful. Otherwise an error is returned." + ], + "CLUSTER ADDSLOTSRANGE": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK` if the command was successful. Otherwise an error is returned." + ], + "CLUSTER BUMPEPOCH": [ + "One of the following:", + "* [Bulk string reply](../topics/protocol.md#bulk-strings): `BUMPED` if the epoch was incremented.", + "* [Bulk string reply](../topics/protocol.md#bulk-strings): `STILL` if the node already has the greatest configured epoch in the cluster." + ], + "CLUSTER COUNT-FAILURE-REPORTS": [ + "[Integer reply](../topics/protocol.md#integers): the number of active failure reports for the node." + ], + "CLUSTER COUNTKEYSINSLOT": [ + "[Integer reply](../topics/protocol.md#integers): The number of keys in the specified hash slot, or an error if the hash slot is invalid." + ], + "CLUSTER DELSLOTS": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK` if the command was successful. Otherwise an error is returned." + ], + "CLUSTER DELSLOTSRANGE": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK` if the command was successful. Otherwise an error is returned." + ], + "CLUSTER FAILOVER": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK` if the command was accepted and a manual failover is going to be attempted. An error if the operation cannot be executed, for example if the client is connected to a node that is already a primary." + ], + "CLUSTER FLUSHSLOTS": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "CLUSTER FORGET": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK` if the command was executed successfully. Otherwise an error is returned." + ], + "CLUSTER GETKEYSINSLOT": [ + "[Array reply](../topics/protocol.md#arrays): an array with up to count elements." + ], + "CLUSTER HELP": [ + "[Array reply](../topics/protocol.md#arrays): a list of subcommands and their descriptions." + ], + "CLUSTER INFO": [ + "[Bulk string reply](../topics/protocol.md#bulk-strings): A map between named fields and values in the form of `:` lines separated by newlines composed by the two bytes `CRLF`." + ], + "CLUSTER KEYSLOT": [ + "[Integer reply](../topics/protocol.md#integers): The hash slot number for the specified key" + ], + "CLUSTER LINKS": [ + "[Array reply](../topics/protocol.md#arrays): an array of [Map reply](../topics/protocol.md#maps) where each map contains various attributes and their values of a cluster link." + ], + "CLUSTER MEET": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK` if the command was successful. If the port or cluster bus port number is out of range, or if an invalid address is specified, an error is returned." + ], + "CLUSTER MYID": [ + "[Bulk string reply](../topics/protocol.md#bulk-strings): the node ID." + ], + "CLUSTER MYSHARDID": [ + "[Bulk string reply](../topics/protocol.md#bulk-strings): the node's shard ID." + ], + "CLUSTER NODES": [ + "[Bulk string reply](../topics/protocol.md#bulk-strings): the serialized cluster configuration." + ], + "CLUSTER REPLICAS": [ + "[Array reply](../topics/protocol.md#arrays): a list of replica nodes replicating from the specified primary node provided in the same format used by `CLUSTER NODES`." + ], + "CLUSTER REPLICATE": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK` if the command was successful. Otherwise an error is returned." + ], + "CLUSTER RESET": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK` if the command was successful. Otherwise an error is returned." + ], + "CLUSTER SAVECONFIG": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK` if the command was successful. Otherwise an error is returned." + ], + "CLUSTER SET-CONFIG-EPOCH": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK` if the command was successful. Otherwise an error is returned." + ], + "CLUSTER SETSLOT": [ + "[Simple string reply](../topics/protocol.md#simple-strings): all the sub-commands return `OK` if the command was successful. Otherwise an error is returned." + ], + "CLUSTER SHARDS": [ + "[Array reply](../topics/protocol.md#arrays): a nested list of [Map reply](../topics/protocol.md#maps) of hash ranges and shard nodes describing individual shards." + ], + "CLUSTER SLAVES": [ + "[Array reply](../topics/protocol.md#arrays): a list of replica nodes replicating from the specified primary node provided in the same format used by `CLUSTER NODES`." + ], + "CLUSTER SLOTS": [ + "[Array reply](../topics/protocol.md#arrays): nested list of slot ranges with networking information." + ], + "CLUSTER SLOT-STATS": [ + "[Array reply](../topics/protocol.md#arrays): nested list of slot usage statistics." + ], + "COMMAND": [ + "[Array reply](../topics/protocol.md#arrays): a nested list of command details. The order of the commands in the array is random." + ], + "COMMAND COUNT": [ + "[Integer reply](../topics/protocol.md#integers): the number of commands returned by `COMMAND`." + ], + "COMMAND DOCS": [ + "[Map reply](../topics/protocol.md#maps): a map where each key is a command name, and each value is the documentary information." + ], + "COMMAND GETKEYS": [ + "[Array reply](../topics/protocol.md#arrays): a list of keys from the given command." + ], + "COMMAND GETKEYSANDFLAGS": [ + "[Array reply](../topics/protocol.md#arrays): a list of keys from the given command and their usage flags." + ], + "COMMAND HELP": [ + "[Array reply](../topics/protocol.md#arrays): a list of sub-commands and their descriptions." + ], + "COMMAND INFO": [ + "[Array reply](../topics/protocol.md#arrays): a nested list of command details." + ], + "COMMAND LIST": [ + "[Array reply](../topics/protocol.md#arrays): a list of command names." + ], + "CONFIG": [], + "CONFIG GET": [ + "[Map reply](../topics/protocol.md#maps): a list of configuration parameters matching the provided arguments." + ], + "CONFIG HELP": [ + "[Array reply](../topics/protocol.md#arrays): a list of sub-commands and their descriptions." + ], + "CONFIG RESETSTAT": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "CONFIG REWRITE": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK` when the configuration was rewritten properly. Otherwise an error is returned." + ], + "CONFIG SET": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK` when the configuration was set properly. Otherwise an error is returned." + ], + "COPY": [ + "One of the following:", + "* [Integer reply](../topics/protocol.md#integers): `1` if _source_ was copied.", + "* [Integer reply](../topics/protocol.md#integers): `0` if _source_ was not copied when the destination key already exists." + ], + "DBSIZE": [ + "[Integer reply](../topics/protocol.md#integers): the number of keys in the currently-selected database." + ], + "DEBUG": [], + "DECR": [ + "[Integer reply](../topics/protocol.md#integers): the value of the key after decrementing it." + ], + "DECRBY": [ + "[Integer reply](../topics/protocol.md#integers): the value of the key after decrementing it." + ], + "DEL": [ + "[Integer reply](../topics/protocol.md#integers): the number of keys that were removed." + ], + "DISCARD": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "DUMP": [ + "One of the following:", + "* [Bulk string reply](../topics/protocol.md#bulk-strings): the serialized value of the key.", + "* [Null reply](../topics/protocol.md#nulls): the key does not exist." + ], + "ECHO": [ + "[Bulk string reply](../topics/protocol.md#bulk-strings): the given string." + ], + "EVAL": [ + "The return value depends on the script that was executed." + ], + "EVALSHA": [ + "The return value depends on the script that was executed." + ], + "EVALSHA_RO": [ + "The return value depends on the script that was executed." + ], + "EVAL_RO": [ + "The return value depends on the script that was executed." + ], + "EXEC": [ + "One of the following:", + "* [Array reply](../topics/protocol.md#arrays): each element being the reply to each of the commands in the atomic transaction.", + "* [Null reply](../topics/protocol.md#nulls): the transaction was aborted because a `WATCH`ed key was touched." + ], + "EXISTS": [ + "[Integer reply](../topics/protocol.md#integers): the number of keys that exist from those specified as arguments." + ], + "EXPIRE": [ + "One of the following:", + "* [Integer reply](../topics/protocol.md#integers): `0` if the timeout was not set; for example, the key doesn't exist, or the operation was skipped because of the provided arguments.", + "* [Integer reply](../topics/protocol.md#integers): `1` if the timeout was set." + ], + "EXPIREAT": [ + "One of the following:", + "* [Integer reply](../topics/protocol.md#integers): `0` if the timeout was not set; for example, the key doesn't exist, or the operation was skipped because of the provided arguments.", + "* [Integer reply](../topics/protocol.md#integers): `1` if the timeout was set." + ], + "EXPIRETIME": [ + "One of the following:", + "* [Integer reply](../topics/protocol.md#integers): the expiration Unix timestamp in seconds.", + "* [Integer reply](../topics/protocol.md#integers): `-1` if the key exists but has no associated expiration time.", + "* [Integer reply](../topics/protocol.md#integers): `-2` if the key does not exist." + ], + "FAILOVER": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK` if the command was accepted and a coordinated failover is in progress. An error if the operation cannot be executed." + ], + "FCALL": [ + "The return value depends on the function that was executed." + ], + "FCALL_RO": [ + "The return value depends on the function that was executed." + ], + "FLUSHALL": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "FLUSHDB": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "FUNCTION": [], + "FUNCTION DELETE": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "FUNCTION DUMP": [ + "[Bulk string reply](../topics/protocol.md#bulk-strings): the serialized payload" + ], + "FUNCTION FLUSH": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "FUNCTION HELP": [ + "[Array reply](../topics/protocol.md#arrays): a list of sub-commands and their descriptions." + ], + "FUNCTION KILL": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "FUNCTION LIST": [ + "[Array reply](../topics/protocol.md#arrays): information about functions and libraries." + ], + "FUNCTION LOAD": [ + "[Bulk string reply](../topics/protocol.md#bulk-strings): the library name that was loaded." + ], + "FUNCTION RESTORE": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "FUNCTION STATS": [ + "[Map reply](../topics/protocol.md#maps): information about the function that's currently running and information about the available execution engines." + ], + "GEOADD": [ + "[Integer reply](../topics/protocol.md#integers): When used without optional arguments, the number of elements added to the sorted set (excluding score updates). If the CH option is specified, the number of elements that were changed (added or updated)." + ], + "GEODIST": [ + "One of the following:", + "* [Null reply](../topics/protocol.md#nulls): one or both of the elements are missing.", + "* [Bulk string reply](../topics/protocol.md#bulk-strings): distance as a double (represented as a string) in the specified units." + ], + "GEOHASH": [ + "[Array reply](../topics/protocol.md#arrays): an array where each element is the Geohash corresponding to each member name passed as an argument to the command." + ], + "GEOPOS": [ + "[Array reply](../topics/protocol.md#arrays): an array where each element is a two elements array representing longitude and latitude (x,y) of each member name passed as argument to the command. Non-existing elements are reported as [Null reply](../topics/protocol.md#nulls) elements of the array." + ], + "GEORADIUS": [ + "One of the following:", + "* If no `WITH*` option is specified, an [Array reply](../topics/protocol.md#arrays) of matched member names", + "* If `WITHCOORD`, `WITHDIST`, or `WITHHASH` options are specified, the command returns an [Array reply](../topics/protocol.md#arrays) of arrays, where each sub-array represents a single item:", + " 1. The distance from the center as a floating point number, in the same unit specified in the radius.", + " 1. The Geohash integer.", + " 1. The coordinates as a two items x,y array (longitude,latitude).", + "", + "For example, the command `GEORADIUS Sicily 15 37 200 km WITHCOORD WITHDIST` will return each item in the following way:", + "", + "`[\"Palermo\",\"190.4424\",[\"13.361389338970184\",\"38.115556395496299\"]]`" + ], + "GEORADIUSBYMEMBER": [ + "One of the following:", + "* If no `WITH*` option is specified, an [Array reply](../topics/protocol.md#arrays) of matched member names", + "* If `WITHCOORD`, `WITHDIST`, or `WITHHASH` options are specified, the command returns an [Array reply](../topics/protocol.md#arrays) of arrays, where each sub-array represents a single item:", + " * The distance from the center as a floating point number, in the same unit specified in the radius.", + " * The Geohash integer.", + " * The coordinates as a two items x,y array (longitude,latitude)." + ], + "GEORADIUSBYMEMBER_RO": [ + "One of the following:", + "* If no `WITH*` option is specified, an [Array reply](../topics/protocol.md#arrays) of matched member names", + "* If `WITHCOORD`, `WITHDIST`, or `WITHHASH` options are specified, the command returns an [Array reply](../topics/protocol.md#arrays) of arrays, where each sub-array represents a single item:", + " * The distance from the center as a floating point number, in the same unit specified in the radius.", + " * The Geohash integer.", + " * The coordinates as a two items x,y array (longitude,latitude)." + ], + "GEORADIUS_RO": [ + "One of the following:", + "* If no `WITH*` option is specified, an [Array reply](../topics/protocol.md#arrays) of matched member names", + "* If `WITHCOORD`, `WITHDIST`, or `WITHHASH` options are specified, the command returns an [Array reply](../topics/protocol.md#arrays) of arrays, where each sub-array represents a single item:", + " * The distance from the center as a floating point number, in the same unit specified in the radius.", + " * The Geohash integer.", + " * The coordinates as a two items x,y array (longitude,latitude)." + ], + "GEOSEARCH": [ + "One of the following:", + "* If no `WITH*` option is specified, an [Array reply](../topics/protocol.md#arrays) of matched member names", + "* If `WITHCOORD`, `WITHDIST`, or `WITHHASH` options are specified, the command returns an [Array reply](../topics/protocol.md#arrays) of arrays, where each sub-array represents a single item:", + " * The distance from the center as a floating point number, in the same unit specified in the radius.", + " * The Geohash integer.", + " * The coordinates as a two items x,y array (longitude,latitude)." + ], + "GEOSEARCHSTORE": [ + "[Integer reply](../topics/protocol.md#integers): the number of elements in the resulting set" + ], + "GET": [ + "One of the following:", + "* [Bulk string reply](../topics/protocol.md#bulk-strings): the value of the key.", + "* [Null reply](../topics/protocol.md#nulls): if the key does not exist." + ], + "GETBIT": [ + "The bit value stored at _offset_, one of the following:", + "* [Integer reply](../topics/protocol.md#integers): `0`.", + "* [Integer reply](../topics/protocol.md#integers): `1`." + ], + "GETDEL": [ + "One of the following:", + "* [Bulk string reply](../topics/protocol.md#bulk-strings): the value of the key.", + "* [Null reply](../topics/protocol.md#nulls): if the key does not exist or if the key's value type is not a string." + ], + "GETEX": [ + "[Bulk string reply](../topics/protocol.md#bulk-strings): the value of `key`", + "[Null reply](../topics/protocol.md#nulls): if `key` does not exist." + ], + "GETRANGE": [ + "[Bulk string reply](../topics/protocol.md#bulk-strings): The substring of the string value stored at key, determined by the offsets start and end (both are inclusive)." + ], + "GETSET": [ + "One of the following:", + "* [Bulk string reply](../topics/protocol.md#bulk-strings): the old value stored at the key.", + "* [Null reply](../topics/protocol.md#nulls): if the key does not exist." + ], + "HDEL": [ + "[Integer reply](../topics/protocol.md#integers): the number of fields that were removed from the hash, excluding any specified but non-existing fields." + ], + "HELLO": [ + "[Map reply](../topics/protocol.md#maps): a list of server properties.", + "[Simple error reply](../topics/protocol.md#simple-errors): if the `protover` requested does not exist." + ], + "HEXISTS": [ + "One of the following:", + "* [Integer reply](../topics/protocol.md#integers): `0` if the hash does not contain the field, or the key does not exist.", + "* [Integer reply](../topics/protocol.md#integers): `1` if the hash contains the field." + ], + "HGET": [ + "One of the following:", + "* [Bulk string reply](../topics/protocol.md#bulk-strings): The value associated with the field.", + "* [Null reply](../topics/protocol.md#nulls): If the field is not present in the hash or key does not exist." + ], + "HGETALL": [ + "[Map reply](../topics/protocol.md#maps): a map of fields and their values stored in the hash, or an empty list when key does not exist." + ], + "HINCRBY": [ + "[Integer reply](../topics/protocol.md#integers): the value of the field after the increment operation." + ], + "HINCRBYFLOAT": [ + "[Bulk string reply](../topics/protocol.md#bulk-strings): the value of the field after the increment operation." + ], + "HKEYS": [ + "[Array reply](../topics/protocol.md#arrays): a list of fields in the hash, or an empty list when the key does not exist." + ], + "HLEN": [ + "[Integer reply](../topics/protocol.md#integers): the number of fields in the hash, or 0 when the key does not exist." + ], + "HMGET": [ + "[Array reply](../topics/protocol.md#arrays): a list of values associated with the given fields, in the same order as they are requested." + ], + "HMSET": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "HRANDFIELD": [ + "Any of the following:", + "* [Null reply](../topics/protocol.md#nulls): if the key doesn't exist", + "* [Bulk string reply](../topics/protocol.md#bulk-strings): a single, randomly selected field when the `count` option is not used", + "* [Array reply](../topics/protocol.md#arrays): a list containing `count` fields when the `count` option is used, or an empty array if the key does not exists.", + "* [Array reply](../topics/protocol.md#arrays): a list of fields and their values when `count` and `WITHVALUES` were both used." + ], + "HSCAN": [ + "[Array reply](../topics/protocol.md#arrays): a two-element array.", + "* The first element is a [Bulk string reply](../topics/protocol.md#bulk-strings) that represents an unsigned 64-bit number, the cursor.", + "* The second element is an [Array reply](../topics/protocol.md#arrays) of field/value pairs that were scanned. When `NOVALUES` option is on, a list of keys from the hash." + ], + "HSET": [ + "[Integer reply](../topics/protocol.md#integers): the number of fields that were added." + ], + "HSETNX": [ + "One of the following:", + "* [Integer reply](../topics/protocol.md#integers): `0` if the field already exists in the hash and no operation was performed.", + "* [Integer reply](../topics/protocol.md#integers): `1` if the field is a new field in the hash and the value was set." + ], + "HSTRLEN": [ + "[Integer reply](../topics/protocol.md#integers): the string length of the value associated with the _field_, or zero when the _field_ isn't present in the hash or the _key_ doesn't exist at all." + ], + "HVALS": [ + "[Array reply](../topics/protocol.md#arrays): a list of values in the hash, or an empty list when the key does not exist." + ], + "INCR": [ + "[Integer reply](../topics/protocol.md#integers): the value of the key after the increment." + ], + "INCRBY": [ + "[Integer reply](../topics/protocol.md#integers): the value of the key after the increment." + ], + "INCRBYFLOAT": [ + "[Bulk string reply](../topics/protocol.md#bulk-strings): the value of the key after the increment." + ], + "INFO": [ + "[Bulk string reply](../topics/protocol.md#bulk-strings): a map of info fields, one field per line in the form of `:` where the value can be a comma separated map like `=`. Also contains section header lines starting with `#` and blank lines.", + "", + "Lines can contain a section name (starting with a `#` character) or a property. All the properties are in the form of `field:value` terminated by `\\r\\n`." + ], + "KEYS": [ + "[Array reply](../topics/protocol.md#arrays): a list of keys matching _pattern_." + ], + "LASTSAVE": [ + "[Integer reply](../topics/protocol.md#integers): UNIX TIME of the last DB save executed with success." + ], + "LATENCY": [], + "LATENCY DOCTOR": [ + "[Verbatim string reply](../topics/protocol.md#verbatim-strings): a human readable latency analysis report." + ], + "LATENCY GRAPH": [ + "[Bulk string reply](../topics/protocol.md#bulk-strings): Latency graph" + ], + "LATENCY HELP": [ + "[Array reply](../topics/protocol.md#arrays): a list of sub-commands and their descriptions." + ], + "LATENCY HISTOGRAM": [ + "[Map reply](../topics/protocol.md#maps): a map where each key is a command name, and each value is a map with the total calls, and an inner map of the histogram time buckets." + ], + "LATENCY HISTORY": [ + "[Array reply](../topics/protocol.md#arrays): an array where each element is a two elements array representing the timestamp and the latency of the event." + ], + "LATENCY LATEST": [ + "[Array reply](../topics/protocol.md#arrays): an array where each element is a four elements array representing the event's name, timestamp, latest and all-time latency measurements." + ], + "LATENCY RESET": [ + "[Integer reply](../topics/protocol.md#integers): the number of event time series that were reset." + ], + "LCS": [ + "One of the following:", + "* [Bulk string reply](../topics/protocol.md#bulk-strings): the longest common subsequence.", + "* [Integer reply](../topics/protocol.md#integers): the length of the longest common subsequence when _LEN_ is given.", + "* [Map reply](../topics/protocol.md#maps): a map with the LCS length and all the ranges in both the strings when _IDX_ is given." + ], + "LINDEX": [ + "One of the following:", + "* [Null reply](../topics/protocol.md#nulls): when _index_ is out of range.", + "* [Bulk string reply](../topics/protocol.md#bulk-strings): the requested element." + ], + "LINSERT": [ + "One of the following:", + "* [Integer reply](../topics/protocol.md#integers): the list length after a successful insert operation.", + "* [Integer reply](../topics/protocol.md#integers): `0` when the key doesn't exist.", + "* [Integer reply](../topics/protocol.md#integers): `-1` when the pivot wasn't found." + ], + "LLEN": [ + "[Integer reply](../topics/protocol.md#integers): the length of the list." + ], + "LMOVE": [ + "[Bulk string reply](../topics/protocol.md#bulk-strings): the element being popped and pushed." + ], + "LMPOP": [ + "One of the following:", + "* [Null reply](../topics/protocol.md#nulls): if no element could be popped.", + "* [Array reply](../topics/protocol.md#arrays): a two-element array with the first element being the name of the key from which elements were popped and the second element being an array of elements." + ], + "LOLWUT": [ + "[Verbatim string reply](../topics/protocol.md#verbatim-strings): a string containing generative computer art and the Valkey version." + ], + "LPOP": [ + "One of the following:", + "* [Null reply](../topics/protocol.md#nulls): if the key does not exist.", + "* [Bulk string reply](../topics/protocol.md#bulk-strings): when called without the _count_ argument, the value of the first element.", + "* [Array reply](../topics/protocol.md#arrays): when called with the _count_ argument, a list of popped elements." + ], + "LPOS": [ + "Any of the following:", + "* [Null reply](../topics/protocol.md#nulls): if there is no matching element.", + "* [Integer reply](../topics/protocol.md#integers): an integer representing the matching element.", + "* [Array reply](../topics/protocol.md#arrays): If the COUNT option is given, an array of integers representing the matching elements (or an empty array if there are no matches)." + ], + "LPUSH": [ + "[Integer reply](../topics/protocol.md#integers): the length of the list after the push operation." + ], + "LPUSHX": [ + "[Integer reply](../topics/protocol.md#integers): the length of the list after the push operation." + ], + "LRANGE": [ + "[Array reply](../topics/protocol.md#arrays): a list of elements in the specified range, or an empty array if the key doesn't exist." + ], + "LREM": [ + "[Integer reply](../topics/protocol.md#integers): the number of removed elements." + ], + "LSET": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "LTRIM": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "MEMORY": [], + "MEMORY DOCTOR": [ + "[Verbatim string reply](../topics/protocol.md#verbatim-strings): a memory problems report." + ], + "MEMORY HELP": [ + "[Array reply](../topics/protocol.md#arrays): a list of sub-commands and their descriptions." + ], + "MEMORY MALLOC-STATS": [ + "[Bulk string reply](../topics/protocol.md#bulk-strings): the memory allocator's internal statistics report." + ], + "MEMORY PURGE": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "MEMORY STATS": [ + "[Map reply](../topics/protocol.md#maps): memory usage metrics and their values." + ], + "MEMORY USAGE": [ + "One of the following:", + "* [Integer reply](../topics/protocol.md#integers): the memory usage in bytes.", + "* [Null reply](../topics/protocol.md#nulls): if the key does not exist." + ], + "MGET": [ + "[Array reply](../topics/protocol.md#arrays): a list of values at the specified keys." + ], + "MIGRATE": [ + "One of the following:", + "* [Simple string reply](../topics/protocol.md#simple-strings): `OK` on success.", + "* [Simple string reply](../topics/protocol.md#simple-strings): `NOKEY` when no keys were found in the source instance." + ], + "MODULE": [], + "MODULE HELP": [ + "[Array reply](../topics/protocol.md#arrays): a list of sub-commands and their descriptions" + ], + "MODULE LIST": [ + "[Array reply](../topics/protocol.md#arrays): list of loaded modules. Each element in the list represents a represents a module, and is a [Map reply](../topics/protocol.md#maps) of property names and their values. The following properties is reported for each loaded module:", + "* name: the name of the module.", + "* ver: the version of the module." + ], + "MODULE LOAD": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK` if the module was loaded." + ], + "MODULE LOADEX": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK` if the module was loaded." + ], + "MODULE UNLOAD": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK` if the module was unloaded." + ], + "MONITOR": [ + "**Non-standard return value**. Dumps the received commands in an infinite flow." + ], + "MOVE": [ + "One of the following:", + "* [Integer reply](../topics/protocol.md#integers): `1` if _key_ was moved.", + "* [Integer reply](../topics/protocol.md#integers): `0` if _key_ already exists in the destination database, or it does not exist in the source database." + ], + "MSET": [ + "[Simple string reply](../topics/protocol.md#simple-strings): always `OK` because `MSET` can't fail." + ], + "MSETNX": [ + "One of the following:", + "* [Integer reply](../topics/protocol.md#integers): `0` if no key was set (at least one key already existed).", + "* [Integer reply](../topics/protocol.md#integers): `1` if all the keys were set." + ], + "MULTI": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "OBJECT": [], + "OBJECT ENCODING": [ + "One of the following:", + "* [Null reply](../topics/protocol.md#nulls): if the key doesn't exist.", + "* [Bulk string reply](../topics/protocol.md#bulk-strings): the encoding of the object." + ], + "OBJECT FREQ": [ + "One of the following:", + "[Integer reply](../topics/protocol.md#integers): the counter's value.", + "[Null reply](../topics/protocol.md#nulls): if _key_ doesn't exist." + ], + "OBJECT HELP": [ + "[Array reply](../topics/protocol.md#arrays): a list of sub-commands and their descriptions." + ], + "OBJECT IDLETIME": [ + "One of the following:", + "[Integer reply](../topics/protocol.md#integers): the idle time in seconds.", + "[Null reply](../topics/protocol.md#nulls): if _key_ doesn't exist." + ], + "OBJECT REFCOUNT": [ + "One of the following:", + "[Integer reply](../topics/protocol.md#integers): the number of references.", + "[Null reply](../topics/protocol.md#nulls): if _key_ doesn't exist." + ], + "PERSIST": [ + "One of the following:", + "* [Integer reply](../topics/protocol.md#integers): `0` if _key_ does not exist or does not have an associated timeout.", + "* [Integer reply](../topics/protocol.md#integers): `1` if the timeout has been removed." + ], + "PEXPIRE": [ + "One of the following:", + "* [Integer reply](../topics/protocol.md#integers): `0`if the timeout was not set. For example, if the key doesn't exist, or the operation skipped because of the provided arguments.", + "* [Integer reply](../topics/protocol.md#integers): `1` if the timeout was set." + ], + "PEXPIREAT": [ + "One of the following:", + "* [Integer reply](../topics/protocol.md#integers): `1` if the timeout was set.", + "* [Integer reply](../topics/protocol.md#integers): `0` if the timeout was not set. For example, if the key doesn't exist, or the operation was skipped due to the provided arguments." + ], + "PEXPIRETIME": [ + "One of the following:", + "* [Integer reply](../topics/protocol.md#integers): Expiration Unix timestamp in milliseconds.", + "* [Integer reply](../topics/protocol.md#integers): `-1` if the key exists but has no associated expiration time.", + "* [Integer reply](../topics/protocol.md#integers): `-2` if the key does not exist." + ], + "PFADD": [ + "One of the following:", + "* [Integer reply](../topics/protocol.md#integers): `1` if at least one HyperLogLog internal register was altered.", + "* [Integer reply](../topics/protocol.md#integers): `0` if no HyperLogLog internal registers were altered." + ], + "PFCOUNT": [ + "[Integer reply](../topics/protocol.md#integers): the approximated number of unique elements observed via `PFADD`." + ], + "PFDEBUG": [], + "PFMERGE": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "PFSELFTEST": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "PING": [ + "Any of the following:", + "* [Simple string reply](../topics/protocol.md#simple-strings): `PONG` when no argument is provided.", + "* [Bulk string reply](../topics/protocol.md#bulk-strings): the provided argument." + ], + "PSETEX": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "PSUBSCRIBE": [ + "When successful, this command doesn't return anything. Instead, for each pattern, one message with the first element being the string `psubscribe` is pushed as a confirmation that the command succeeded." + ], + "PSYNC": [ + "**Non-standard return value**, a bulk transfer of the data followed by `PING` and write requests from the primary." + ], + "PTTL": [ + "One of the following:", + "* [Integer reply](../topics/protocol.md#integers): TTL in milliseconds.", + "* [Integer reply](../topics/protocol.md#integers): `-1` if the key exists but has no associated expiration.", + "* [Integer reply](../topics/protocol.md#integers): `-2` if the key does not exist." + ], + "PUBLISH": [ + "[Integer reply](../topics/protocol.md#integers): the number of clients that received the message. Note that in a Valkey Cluster, only clients that are connected to the same node as the publishing client are included in the count." + ], + "PUBSUB": [], + "PUBSUB CHANNELS": [ + "[Array reply](../topics/protocol.md#arrays): a list of active channels, optionally matching the specified pattern." + ], + "PUBSUB HELP": [ + "[Array reply](../topics/protocol.md#arrays): a list of sub-commands and their descriptions." + ], + "PUBSUB NUMPAT": [ + "[Integer reply](../topics/protocol.md#integers): the number of patterns all the clients are subscribed to." + ], + "PUBSUB NUMSUB": [ + "[Array reply](../topics/protocol.md#arrays): the number of subscribers per channel, each even element (including the 0th) is channel name, each odd element is the number of subscribers" + ], + "PUBSUB SHARDCHANNELS": [ + "[Array reply](../topics/protocol.md#arrays): a list of active channels, optionally matching the specified pattern." + ], + "PUBSUB SHARDNUMSUB": [ + "[Array reply](../topics/protocol.md#arrays): the number of subscribers per shard channel, each even element (including the 0th) is channel name, each odd element is the number of subscribers." + ], + "PUNSUBSCRIBE": [ + "When successful, this command doesn't return anything. Instead, for each pattern, one message with the first element being the string `punsubscribe` is pushed as a confirmation that the command succeeded." + ], + "QUIT": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "RANDOMKEY": [ + "One of the following:", + "* [Null reply](../topics/protocol.md#nulls): when the database is empty.", + "* [Bulk string reply](../topics/protocol.md#bulk-strings): a random key in the database." + ], + "READONLY": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "READWRITE": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "RENAME": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "RENAMENX": [ + "One of the following:", + "* [Integer reply](../topics/protocol.md#integers): `1` if _key_ was renamed to _newkey_.", + "* [Integer reply](../topics/protocol.md#integers): `0` if _newkey_ already exists." + ], + "REPLCONF": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "REPLICAOF": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "RESET": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `RESET`." + ], + "RESTORE": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "RESTORE-ASKING": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "ROLE": [ + "[Array reply](../topics/protocol.md#arrays): where the first element is one of `master`, `slave`, or `sentinel`, and the additional elements are role-specific as illustrated above." + ], + "RPOP": [ + "One of the following:", + "* [Null reply](../topics/protocol.md#nulls): if the key does not exist.", + "* [Bulk string reply](../topics/protocol.md#bulk-strings): when called without the _count_ argument, the value of the last element.", + "* [Array reply](../topics/protocol.md#arrays): when called with the _count_ argument, a list of popped elements." + ], + "RPOPLPUSH": [ + "One of the following:", + "* [Bulk string reply](../topics/protocol.md#bulk-strings): the element being popped and pushed.", + "* [Null reply](../topics/protocol.md#nulls): if the source list is empty." + ], + "RPUSH": [ + "[Integer reply](../topics/protocol.md#integers): the length of the list after the push operation." + ], + "RPUSHX": [ + "[Integer reply](../topics/protocol.md#integers): the length of the list after the push operation." + ], + "SADD": [ + "[Integer reply](../topics/protocol.md#integers): the number of elements that were added to the set, not including all the elements already present in the set." + ], + "SAVE": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "SCAN": [ + "[Array reply](../topics/protocol.md#arrays): specifically, an array with two elements.", + "* The first element is a [Bulk string reply](../topics/protocol.md#bulk-strings) that represents an unsigned 64-bit number, the cursor.", + "* The second element is an [Array reply](../topics/protocol.md#arrays) with the names of scanned keys." + ], + "SCARD": [ + "[Integer reply](../topics/protocol.md#integers): the cardinality (number of elements) of the set, or `0` if the key does not exist." + ], + "SCRIPT": [], + "SCRIPT DEBUG": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "SCRIPT EXISTS": [ + "[Array reply](../topics/protocol.md#arrays): an array of integers that correspond to the specified SHA1 digest arguments." + ], + "SCRIPT FLUSH": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "SCRIPT HELP": [ + "[Array reply](../topics/protocol.md#arrays): a list of sub-commands and their descriptions." + ], + "SCRIPT KILL": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "SCRIPT LOAD": [ + "[Bulk string reply](../topics/protocol.md#bulk-strings): the SHA1 digest of the script added into the script cache." + ], + "SCRIPT SHOW": [ + "[Bulk string reply](../topics/protocol.md#bulk-strings): Lua script if sha1 hash exists in script cache." + ], + "SDIFF": [ + "[Set reply](../topics/protocol.md#sets): the resulting set." + ], + "SDIFFSTORE": [ + "[Integer reply](../topics/protocol.md#integers): the number of elements in the resulting set." + ], + "SELECT": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "SENTINEL CKQUORUM": [ + "[Bulk string reply](../topics/protocol.md#bulk-strings): Returns OK if the current Sentinel configuration is able to reach the quorum needed to failover a primary, and the majority needed to authorize the failover." + ], + "SENTINEL CONFIG": [ + "One of the following:", + "* [Map reply](../topics/protocol.md#maps): When 'SENTINEL-CONFIG GET' is called, returns a map.", + "* [Simple string reply](../topics/protocol.md#simple-strings): `OK`. When 'SENTINEL-CONFIG SET' is called, returns OK on success." + ], + "SENTINEL DEBUG": [ + "One of the following:", + "* [Simple string reply](../topics/protocol.md#simple-strings): `OK`. The configuration update was successful.", + "* [Map reply](../topics/protocol.md#maps): List of configurable time parameters and their values (milliseconds)." + ], + "SENTINEL FAILOVER": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`. Force a fail over as if the primary was not reachable, and without asking for agreement to other Sentinels." + ], + "SENTINEL FLUSHCONFIG": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`. Force Sentinel to rewrite its configuration on disk, including the current Sentinel state." + ], + "SENTINEL GET PRIMARY-ADDR-BY-NAME": [], + "SENTINEL HELP": [ + "[Array reply](../topics/protocol.md#arrays): Helpful text about subcommands." + ], + "SENTINEL INFO CACHE": [ + "[Array reply](../topics/protocol.md#arrays): This is actually a map, the odd entries are a primary name, and the even entries are the last cached INFO output from that primary and all its replicas." + ], + "SENTINEL IS PRIMARY-DOWN-BY-ADDR": [], + "SENTINEL PRIMARY": [ + "[Map reply](../topics/protocol.md#maps): The state and info of the specified primary." + ], + "SENTINEL PRIMARIES": [ + "[Array reply](../topics/protocol.md#arrays): List of monitored Valkey primaries, and their state." + ], + "SENTINEL MONITOR": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "SENTINEL MYID": [ + "[Bulk string reply](../topics/protocol.md#bulk-strings): Node ID of the sentinel instance." + ], + "SENTINEL PENDING SCRIPTS": [ + "[Array reply](../topics/protocol.md#arrays): List of pending scripts." + ], + "SENTINEL REMOVE": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "SENTINEL REPLICAS": [ + "[Array reply](../topics/protocol.md#arrays): List of replicas for this primary, and their state." + ], + "SENTINEL RESET": [ + "[Integer reply](../topics/protocol.md#integers): The number of primaries that were reset." + ], + "SENTINEL SENTINELS": [ + "[Array reply](../topics/protocol.md#arrays): List of sentinel instances, and their state." + ], + "SENTINEL SET": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "SENTINEL SIMULATE FAILURE": [ + "One of the following:", + "* [Simple string reply](../topics/protocol.md#simple-strings): `OK`. The simulated flag was set.", + "* [Array reply](../topics/protocol.md#arrays): Supported simulates flags. Returned in case `HELP` was used." + ], + "SENTINEL SLAVES": [ + "[Array reply](../topics/protocol.md#arrays): List of monitored replicas, and their state." + ], + "SET": [ + "If `GET` not given, any of the following:", + "* [Null reply](../topics/protocol.md#nulls): Operation was aborted (conflict with one of the `XX`/`NX` options).", + "* [Simple string reply](../topics/protocol.md#simple-strings): `OK`: The key was set.", + "If `GET` given, any of the following:", + "* [Null reply](../topics/protocol.md#nulls): The key didn't exist before the `SET`.", + "* [Bulk string reply](../topics/protocol.md#bulk-strings): The previous value of the key.", + "Note that when using `GET` together with `XX`/`NX`/`IFEQ`, the reply indirectly indicates whether the key was set:", + "* `GET` and `XX` given: Non-[Null reply](../topics/protocol.md#nulls) indicates the key was set.", + "* `GET` and `NX` given: [Null reply](../topics/protocol.md#nulls) indicates the key was set.", + "* `GET` and `IFEQ` given: The key was set if the reply is equal to `comparison-value`." + ], + "SETBIT": [ + "[Integer reply](../topics/protocol.md#integers): the original bit value stored at _offset_." + ], + "SETEX": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "SETNX": [ + "One of the following:", + "* [Integer reply](../topics/protocol.md#integers): `0` if the key was not set.", + "* [Integer reply](../topics/protocol.md#integers): `1` if the key was set." + ], + "SETRANGE": [ + "[Integer reply](../topics/protocol.md#integers): the length of the string after it was modified by the command." + ], + "SHUTDOWN": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK` if _ABORT_ was specified and shutdown was aborted. On successful shutdown, nothing is returned because the server quits and the connection is closed. On failure, an error is returned." + ], + "SINTER": [ + "[Set reply](../topics/protocol.md#sets): the resulting set." + ], + "SINTERCARD": [ + "[Integer reply](../topics/protocol.md#integers): the number of elements in the resulting intersection." + ], + "SINTERSTORE": [ + "[Integer reply](../topics/protocol.md#integers): the number of elements in the resulting set." + ], + "SISMEMBER": [ + "One of the following:", + "* [Integer reply](../topics/protocol.md#integers): `0` if the element is not a member of the set, or when the key does not exist.", + "* [Integer reply](../topics/protocol.md#integers): `1` if the element is a member of the set." + ], + "SLAVEOF": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "SLOWLOG": [], + "SLOWLOG GET": [ + "[Array reply](../topics/protocol.md#arrays): a list of slow log entries per the above format." + ], + "SLOWLOG HELP": [ + "[Array reply](../topics/protocol.md#arrays): a list of sub-commands and their descriptions." + ], + "SLOWLOG LEN": [ + "[Integer reply](../topics/protocol.md#integers): the number of entries in the slow log." + ], + "SLOWLOG RESET": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "SMEMBERS": [ + "[Set reply](../topics/protocol.md#sets): all members of the set." + ], + "SMISMEMBER": [ + "[Array reply](../topics/protocol.md#arrays): a list representing the membership of the given elements, in the same order as they are requested." + ], + "SMOVE": [ + "One of the following:", + "* [Integer reply](../topics/protocol.md#integers): `1` if the element is moved.", + "* [Integer reply](../topics/protocol.md#integers): `0` if the element is not a member of _source_ and no operation was performed." + ], + "SORT": [ + "[Array reply](../topics/protocol.md#arrays): without passing the _STORE_ option, the command returns a list of sorted elements.", + "[Integer reply](../topics/protocol.md#integers): when the _STORE_ option is specified, the command returns the number of sorted elements in the destination list." + ], + "SORT_RO": [ + "[Array reply](../topics/protocol.md#arrays): a list of sorted elements." + ], + "SPOP": [ + "One of the following:", + "* [Null reply](../topics/protocol.md#nulls): if the key does not exist.", + "* [Bulk string reply](../topics/protocol.md#bulk-strings): when called without the _count_ argument, the removed member.", + "* [Set reply](../topics/protocol.md#sets): when called with the _count_ argument, the set of removed members." + ], + "SPUBLISH": [ + "[Integer reply](../topics/protocol.md#integers): the number of clients that received the message. Note that in a Valkey Cluster, only clients that are connected to the same node as the publishing client are included in the count" + ], + "SRANDMEMBER": [ + "One of the following:", + "* [Bulk string reply](../topics/protocol.md#bulk-strings): without the additional _count_ argument, the command returns a randomly selected member, or a [Null reply](../topics/protocol.md#nulls) when _key_ doesn't exist.", + "* [Array reply](../topics/protocol.md#arrays): when the optional _count_ argument is passed, the command returns an array of members, or an empty array when _key_ doesn't exist." + ], + "SREM": [ + "[Integer reply](../topics/protocol.md#integers): the number of members that were removed from the set, not including non existing members." + ], + "SSCAN": [ + "[Array reply](../topics/protocol.md#arrays): specifically, an array with two elements:", + "* The first element is a [Bulk string reply](../topics/protocol.md#bulk-strings) that represents an unsigned 64-bit number, the cursor.", + "* The second element is an [Array reply](../topics/protocol.md#arrays) with the names of scanned members." + ], + "SSUBSCRIBE": [ + "When successful, this command doesn't return anything. Instead, for each shard channel, one message with the first element being the string `ssubscribe` is pushed as a confirmation that the command succeeded. Note that this command can also return a -MOVED redirect." + ], + "STRLEN": [ + "[Integer reply](../topics/protocol.md#integers): the length of the string stored at key, or 0 when the key does not exist." + ], + "SUBSCRIBE": [ + "When successful, this command doesn't return anything. Instead, for each channel, one message with the first element being the string `subscribe` is pushed as a confirmation that the command succeeded." + ], + "SUBSTR": [ + "[Bulk string reply](../topics/protocol.md#bulk-strings): the substring of the string value stored at key, determined by the offsets start and end (both are inclusive)." + ], + "SUNION": [ + "[Set reply](../topics/protocol.md#sets): the resulting set." + ], + "SUNIONSTORE": [ + "[Integer reply](../topics/protocol.md#integers): the number of elements in the resulting set." + ], + "SUNSUBSCRIBE": [ + "When successful, this command doesn't return anything. Instead, for each shard channel, one message with the first element being the string `sunsubscribe` is pushed as a confirmation that the command succeeded." + ], + "SWAPDB": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "SYNC": [ + "**Non-standard return value**, a bulk transfer of the data followed by `PING` and write requests from the primary." + ], + "TIME": [ + "[Array reply](../topics/protocol.md#arrays): specifically, a two-element array consisting of the Unix timestamp in seconds and the microseconds' count." + ], + "TOUCH": [ + "[Integer reply](../topics/protocol.md#integers): the number of touched keys." + ], + "TTL": [ + "One of the following:", + "* [Integer reply](../topics/protocol.md#integers): TTL in seconds.", + "* [Integer reply](../topics/protocol.md#integers): `-1` if the key exists but has no associated expiration.", + "* [Integer reply](../topics/protocol.md#integers): `-2` if the key does not exist." + ], + "TYPE": [ + "[Simple string reply](../topics/protocol.md#simple-strings): the type of _key_, or `none` when _key_ doesn't exist." + ], + "UNLINK": [ + "[Integer reply](../topics/protocol.md#integers): the number of keys that were unlinked." + ], + "UNSUBSCRIBE": [ + "When successful, this command doesn't return anything. Instead, for each channel, one message with the first element being the string `unsubscribe` is pushed as a confirmation that the command succeeded." + ], + "UNWATCH": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "WAIT": [ + "[Integer reply](../topics/protocol.md#integers): the number of replicas reached by all the writes performed in the context of the current connection." + ], + "WAITAOF": [ + "[Array reply](../topics/protocol.md#arrays): The command returns an array of two integers:", + "1. The first is the number of local Valkey nodes (0 or 1) that have fsynced to AOF all writes performed in the context of the current connection", + "2. The second is the number of replicas that have acknowledged doing the same." + ], + "WATCH": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "XACK": [ + "[Integer reply](../topics/protocol.md#integers): The command returns the number of messages successfully acknowledged. Certain message IDs may no longer be part of the PEL (for example because they have already been acknowledged), and XACK will not count them as successfully acknowledged." + ], + "XADD": [ + "One of the following:", + "* [Bulk string reply](../topics/protocol.md#bulk-strings): The ID of the added entry. The ID is the one automatically generated if an asterisk (`*`) is passed as the _id_ argument, otherwise the command just returns the same ID specified by the user during insertion.", + "* [Null reply](../topics/protocol.md#nulls): if the NOMKSTREAM option is given and the key doesn't exist." + ], + "XAUTOCLAIM": [ + "[Array reply](../topics/protocol.md#arrays), specifically, an array with three elements:", + "1. A stream ID to be used as the _start_ argument for the next call to XAUTOCLAIM.", + "2. An [Array reply](../topics/protocol.md#arrays) containing all the successfully claimed messages in the same format as `XRANGE`.", + "3. An [Array reply](../topics/protocol.md#arrays) containing message IDs that no longer exist in the stream, and were deleted from the PEL in which they were found." + ], + "XCLAIM": [ + "Any of the following:", + "* [Array reply](../topics/protocol.md#arrays): when the _JUSTID_ option is specified, an array of IDs of messages successfully claimed.", + "* [Array reply](../topics/protocol.md#arrays): an array of stream entries, each of which contains an array of two elements, the entry ID and the entry data itself." + ], + "XDEL": [ + "[Integer reply](../topics/protocol.md#integers): the number of entries that were deleted." + ], + "XGROUP": [], + "XGROUP CREATE": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "XGROUP CREATECONSUMER": [ + "[Integer reply](../topics/protocol.md#integers): the number of created consumers, either 0 or 1." + ], + "XGROUP DELCONSUMER": [ + "[Integer reply](../topics/protocol.md#integers): the number of pending messages the consumer had before it was deleted." + ], + "XGROUP DESTROY": [ + "[Integer reply](../topics/protocol.md#integers): the number of destroyed consumer groups, either 0 or 1." + ], + "XGROUP HELP": [ + "[Array reply](../topics/protocol.md#arrays): a list of sub-commands and their descriptions." + ], + "XGROUP SETID": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "XINFO": [], + "XINFO CONSUMERS": [ + "[Array reply](../topics/protocol.md#arrays): a list of consumers and their attributes." + ], + "XINFO GROUPS": [ + "[Array reply](../topics/protocol.md#arrays): a list of consumer groups." + ], + "XINFO HELP": [ + "[Array reply](../topics/protocol.md#arrays): a list of sub-commands and their descriptions." + ], + "XINFO STREAM": [ + "One of the following:", + "* [Map reply](../topics/protocol.md#maps): when the _FULL_ argument was not given, a list of information about a stream in summary form.", + "* [Map reply](../topics/protocol.md#maps): when the _FULL_ argument was given, a list of information about a stream in extended form." + ], + "XLEN": [ + "[Integer reply](../topics/protocol.md#integers): the number of entries of the stream at _key_." + ], + "XPENDING": [ + "* [Array reply](../topics/protocol.md#arrays): different data depending on the way XPENDING is called, as explained on this page." + ], + "XRANGE": [ + "[Array reply](../topics/protocol.md#arrays): a list of stream entries with IDs matching the specified range." + ], + "XREAD": [ + "One of the following:", + "* [Map reply](../topics/protocol.md#maps): A map of key-value elements where each element is composed of the key name and the entries reported for that key. The entries reported are full stream entries, having IDs and the list of all the fields and values. Field and values are guaranteed to be reported in the same order they were added by `XADD`.", + "* [Null reply](../topics/protocol.md#nulls): if the _BLOCK_ option is given and a timeout occurs, or if there is no stream that can be served." + ], + "XREADGROUP": [ + "One of the following:", + "* [Map reply](../topics/protocol.md#maps): A map of key-value elements where each element is composed of the key name and the entries reported for that key. The entries reported are full stream entries, having IDs and the list of all the fields and values. Field and values are guaranteed to be reported in the same order they were added by `XADD`.", + "* [Null reply](../topics/protocol.md#nulls): if the _BLOCK_ option is given and a timeout occurs, or if there is no stream that can be served." + ], + "XREVRANGE": [ + "[Array reply](../topics/protocol.md#arrays): The command returns the entries with IDs matching the specified range. The returned entries are complete, which means that the ID and all the fields they are composed of are returned. Moreover, the entries are returned with their fields and values in the same order as `XADD` added them." + ], + "XSETID": [ + "[Simple string reply](../topics/protocol.md#simple-strings): `OK`." + ], + "XTRIM": [ + "[Integer reply](../topics/protocol.md#integers): The number of entries deleted from the stream." + ], + "ZADD": [ + "Any of the following:", + "* [Null reply](../topics/protocol.md#nulls): if the operation was aborted because of a conflict with one of the _XX/NX/LT/GT_ options.", + "* [Integer reply](../topics/protocol.md#integers): the number of new members when the _CH_ option is not used.", + "* [Integer reply](../topics/protocol.md#integers): the number of new or updated members when the _CH_ option is used.", + "* [Double reply](../topics/protocol.md#doubles): the updated score of the member when the _INCR_ option is used." + ], + "ZCARD": [ + "[Integer reply](../topics/protocol.md#integers): the cardinality (number of members) of the sorted set, or 0 if the key doesn't exist." + ], + "ZCOUNT": [ + "[Integer reply](../topics/protocol.md#integers): the number of members in the specified score range." + ], + "ZDIFF": [ + "* [Array reply](../topics/protocol.md#arrays): the result of the difference including, optionally, scores when the _WITHSCORES_ option is used." + ], + "ZDIFFSTORE": [ + "[Integer reply](../topics/protocol.md#integers): the number of members in the resulting sorted set at _destination_." + ], + "ZINCRBY": [ + "[Double reply](../topics/protocol.md#doubles): the new score of _member_." + ], + "ZINTER": [ + "* [Array reply](../topics/protocol.md#arrays): the result of the intersection including, optionally, scores when the _WITHSCORES_ option is used." + ], + "ZINTERCARD": [ + "[Integer reply](../topics/protocol.md#integers): the number of members in the resulting intersection." + ], + "ZINTERSTORE": [ + "[Integer reply](../topics/protocol.md#integers): the number of members in the resulting sorted set at the _destination_." + ], + "ZLEXCOUNT": [ + "[Integer reply](../topics/protocol.md#integers): the number of members in the specified score range." + ], + "ZMPOP": [ + "One of the following:", + "* [Null reply](../topics/protocol.md#nulls): when no element could be popped.", + "* [Array reply](../topics/protocol.md#arrays): A two-element array with the first element being the name of the key from which elements were popped, and the second element is an array of the popped elements. Every entry in the elements array is also an array that contains the member and its score." + ], + "ZMSCORE": [ + "One of the following:", + "* [Null reply](../topics/protocol.md#nulls): if the member does not exist in the sorted set.", + "* [Array reply](../topics/protocol.md#arrays): a list of [Double reply](../topics/protocol.md#doubles) _member_ scores as double-precision floating point numbers." + ], + "ZPOPMAX": [ + "* [Array reply](../topics/protocol.md#arrays): a list of popped elements and scores." + ], + "ZPOPMIN": [ + "* [Array reply](../topics/protocol.md#arrays): a list of popped elements and scores." + ], + "ZRANDMEMBER": [ + "[Bulk string reply](../topics/protocol.md#bulk-strings): without the additional _count_ argument, the command returns a randomly selected member, or [Null reply](../topics/protocol.md#nulls) when _key_ doesn't exist.", + "[Array reply](../topics/protocol.md#arrays): when the additional _count_ argument is passed, the command returns an array of members, or an empty array when _key_ doesn't exist. If the _WITHSCORES_ modifier is used, the reply is a list of members and their scores from the sorted set." + ], + "ZRANGE": [ + "[Array reply](../topics/protocol.md#arrays): a list of members in the specified range with, optionally, their scores when the _WITHSCORES_ option is given." + ], + "ZRANGEBYLEX": [ + "[Array reply](../topics/protocol.md#arrays): a list of elements in the specified score range." + ], + "ZRANGEBYSCORE": [ + "* [Array reply](../topics/protocol.md#arrays): a list of the members with, optionally, their scores in the specified score range." + ], + "ZRANGESTORE": [ + "[Integer reply](../topics/protocol.md#integers): the number of elements in the resulting sorted set." + ], + "ZRANK": [ + "One of the following:", + "* [Null reply](../topics/protocol.md#nulls): if the key does not exist or the member does not exist in the sorted set.", + "* [Integer reply](../topics/protocol.md#integers): the rank of the member when _WITHSCORE_ is not used.", + "* [Array reply](../topics/protocol.md#arrays): the rank and score of the member when _WITHSCORE_ is used." + ], + "ZREM": [ + "[Integer reply](../topics/protocol.md#integers): the number of members removed from the sorted set, not including non-existing members." + ], + "ZREMRANGEBYLEX": [ + "[Integer reply](../topics/protocol.md#integers): the number of members removed." + ], + "ZREMRANGEBYRANK": [ + "[Integer reply](../topics/protocol.md#integers): the number of members removed." + ], + "ZREMRANGEBYSCORE": [ + "[Integer reply](../topics/protocol.md#integers): the number of members removed." + ], + "ZREVRANGE": [ + "* [Array reply](../topics/protocol.md#arrays): a list of the members in the specified range, optionally with their scores if _WITHSCORE_ was used." + ], + "ZREVRANGEBYLEX": [ + "[Array reply](../topics/protocol.md#arrays): a list of the members in the specified score range." + ], + "ZREVRANGEBYSCORE": [ + "* [Array reply](../topics/protocol.md#arrays): a list of the members and, optionally, their scores in the specified score range." + ], + "ZREVRANK": [ + "One of the following:", + "* [Null reply](../topics/protocol.md#nulls): if the key does not exist or the member does not exist in the sorted set.", + "* [Integer reply](../topics/protocol.md#integers): The rank of the member when _WITHSCORE_ is not used.", + "* [Array reply](../topics/protocol.md#arrays): The rank and score of the member when _WITHSCORE_ is used." + ], + "ZSCAN": [ + "[Array reply](../topics/protocol.md#arrays): a two-element array.", + "* The first element is a [Bulk string reply](../topics/protocol.md#bulk-strings) that represents an unsigned 64-bit number, the cursor.", + "* The second element is an [Array reply](../topics/protocol.md#arrays) of member/score pairs that were scanned. When `NOSCORES` option is on, a list of members from the sorted set." + ], + "ZSCORE": [ + "One of the following:", + "* [Double reply](../topics/protocol.md#doubles): the score of the member (a double-precision floating point number).", + "* [Null reply](../topics/protocol.md#nulls): if _member_ does not exist in the sorted set, or the key does not exist." + ], + "ZUNION": [ + "[Array reply](../topics/protocol.md#arrays): the result of the union with, optionally, their scores when _WITHSCORES_ is used." + ], + "ZUNIONSTORE": [ + "[Integer reply](../topics/protocol.md#integers): the number of elements in the resulting sorted set." + ] +} \ No newline at end of file diff --git a/Sources/RedisCommandsBuilder/SwiftString.swift b/Sources/ValkeyCommandsBuilder/SwiftString.swift similarity index 100% rename from Sources/RedisCommandsBuilder/SwiftString.swift rename to Sources/ValkeyCommandsBuilder/SwiftString.swift diff --git a/Sources/RedisCommandsBuilder/RedisCommandJSON.swift b/Sources/ValkeyCommandsBuilder/ValkeyCommandJSON.swift similarity index 96% rename from Sources/RedisCommandsBuilder/RedisCommandJSON.swift rename to Sources/ValkeyCommandsBuilder/ValkeyCommandJSON.swift index 9ebcb6a4..94cd12fd 100644 --- a/Sources/RedisCommandsBuilder/RedisCommandJSON.swift +++ b/Sources/ValkeyCommandsBuilder/ValkeyCommandJSON.swift @@ -1,15 +1,15 @@ import Foundation -struct RedisCommands: Decodable { - let commands: [String: RedisCommand] +struct ValkeyCommands: Decodable { + let commands: [String: RESPCommand] init(from decoder: any Decoder) throws { let container = try decoder.singleValueContainer() - self.commands = try container.decode([String: RedisCommand].self) + self.commands = try container.decode([String: RESPCommand].self) } } -struct RedisCommand: Decodable { +struct RESPCommand: Decodable { enum ArgumentType: String, Decodable { case integer case double diff --git a/Sources/RedisCommandsBuilder/RedisCommandsRender.swift b/Sources/ValkeyCommandsBuilder/ValkeyCommandsRender.swift similarity index 88% rename from Sources/RedisCommandsBuilder/RedisCommandsRender.swift rename to Sources/ValkeyCommandsBuilder/ValkeyCommandsRender.swift index 0796d166..3335a05b 100644 --- a/Sources/RedisCommandsBuilder/RedisCommandsRender.swift +++ b/Sources/ValkeyCommandsBuilder/ValkeyCommandsRender.swift @@ -1,19 +1,19 @@ extension String { var cleanupReplyComment: String { self - .replacing("/docs/reference", with: "https:/redis.io/docs/reference") + .replacing("../topics/protocol.md", with: "https:/valkey.io/topics/protocol/") .replacing(" reply]", with: "]") } - mutating func appendCommandCommentHeader(command: RedisCommand, name: String, reply: [String], tab: String) { + mutating func appendCommandCommentHeader(command: RESPCommand, name: String, reply: [String], tab: String) { self.append("\(tab)/// \(command.summary)\n") } - mutating func appendFunctionCommentHeader(command: RedisCommand, name: String, reply: [String]) { + mutating func appendFunctionCommentHeader(command: RESPCommand, name: String, reply: [String]) { let linkName = name.replacing(" ", with: "-").lowercased() self.append(" /// \(command.summary)\n") self.append(" ///\n") - self.append(" /// - Documentation: [\(name)](https:/redis.io/docs/latest/commands/\(linkName))\n") + self.append(" /// - Documentation: [\(name)](https:/valkey.io/commands/\(linkName))\n") self.append(" /// - Version: \(command.since)\n") if let complexity = command.complexity { self.append(" /// - Complexity: \(complexity)\n") @@ -27,7 +27,7 @@ extension String { } } - mutating func appendOneOfEnum(argument: RedisCommand.Argument, names: [String], tab: String) { + mutating func appendOneOfEnum(argument: RESPCommand.Argument, names: [String], tab: String) { guard let arguments = argument.arguments, arguments.count > 0 else { preconditionFailure("OneOf without arguments") } @@ -50,7 +50,7 @@ extension String { } self.append("\n") self.append("\(tab) @inlinable\n") - self.append("\(tab) public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int {\n") + self.append("\(tab) public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int {\n") self.append("\(tab) switch self {\n") for arg in arguments { if case .pureToken = arg.type { @@ -59,7 +59,7 @@ extension String { ) } else { self.append( - "\(tab) case .\(arg.swiftArgument)(let \(arg.swiftArgument)): \(arg.redisRepresentable(isArray: false)).encode(into: &commandEncoder)\n" + "\(tab) case .\(arg.swiftArgument)(let \(arg.swiftArgument)): \(arg.respRepresentable(isArray: false)).encode(into: &commandEncoder)\n" ) } } @@ -68,7 +68,7 @@ extension String { self.append("\(tab) }\n") } - mutating func appendBlock(argument: RedisCommand.Argument, names: [String], tab: String) { + mutating func appendBlock(argument: RESPCommand.Argument, names: [String], tab: String) { guard let arguments = argument.arguments, arguments.count > 0 else { preconditionFailure("OneOf without arguments") } @@ -89,13 +89,13 @@ extension String { } self.append("\n") self.append("\(tab) @inlinable\n") - self.append("\(tab) public func encode(into commandEncoder: inout RedisCommandEncoder) -> Int {\n") + self.append("\(tab) public func encode(into commandEncoder: inout RESPCommandEncoder) -> Int {\n") self.append("\(tab) var count = 0\n") for arg in arguments { if case .pureToken = arg.type { self.append("\(tab) if self.\(arg.swiftArgument) { count += \"\(arg.token!)\".encode(into: &commandEncoder) }\n") } else { - self.append("\(tab) count += \(arg.redisRepresentable(isArray: false)).encode(into: &commandEncoder)\n") + self.append("\(tab) count += \(arg.respRepresentable(isArray: false)).encode(into: &commandEncoder)\n") } } self.append("\(tab) return count\n") @@ -103,7 +103,7 @@ extension String { self.append("\(tab) }\n") } - mutating func appendCommand(command: RedisCommand, reply: [String], name: String, tab: String) { + mutating func appendCommand(command: RESPCommand, reply: [String], name: String, tab: String) { var commandName = name var subCommand: String? = nil let typeName: String @@ -118,7 +118,7 @@ extension String { // Comment header self.appendCommandCommentHeader(command: command, name: name, reply: reply, tab: tab) - self.append("\(tab)public struct \(typeName): RedisCommand {\n") + self.append("\(tab)public struct \(typeName): RESPCommand {\n") let arguments = (command.arguments ?? []) // Enums @@ -138,9 +138,9 @@ extension String { .joined(separator: ", ") let commandArguments = if let subCommand { - ["\"\(commandName)\"", "\"\(subCommand)\""] + arguments.map { $0.redisRepresentable(isArray: true) } + ["\"\(commandName)\"", "\"\(subCommand)\""] + arguments.map { $0.respRepresentable(isArray: true) } } else { - ["\"\(commandName)\""] + arguments.map { $0.redisRepresentable(isArray: true) } + ["\"\(commandName)\""] + arguments.map { $0.respRepresentable(isArray: true) } } let commandArgumentsString = commandArguments.joined(separator: ", ") self.append("\(tab) public typealias Response = \(returnType)\n\n") @@ -152,13 +152,13 @@ extension String { self.append("\(tab) self.\(arg.name.swiftVariable) = \(arg.name.swiftVariable)\n") } self.append("\(tab) }\n\n") - self.append("\(tab) @inlinable public func encode(into commandEncoder: inout RedisCommandEncoder) {\n") + self.append("\(tab) @inlinable public func encode(into commandEncoder: inout RESPCommandEncoder) {\n") self.append("\(tab) commandEncoder.encodeArray(\(commandArgumentsString))\n") self.append("\(tab) }\n") self.append("\(tab)}\n\n") } - mutating func appendFunction(command: RedisCommand, reply: [String], name: String) { + mutating func appendFunction(command: RESPCommand, reply: [String], name: String) { let arguments = (command.arguments ?? []) //var converting: Bool = false var returnType: String = " -> RESPToken" @@ -194,26 +194,25 @@ extension String { } } -func renderRedisCommands(_ commands: [String: RedisCommand], replies: RESPReplies) -> String { +func renderValkeyCommands(_ commands: [String: RESPCommand], replies: RESPReplies) -> String { var string = """ //===----------------------------------------------------------------------===// // - // This source file is part of the swift-redis open source project + // This source file is part of the swift-valkey open source project // - // Copyright (c) 2025 Apple Inc. and the swift-redis project authors + // Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information - // See CONTRIBUTORS.txt for the list of swift-redis project authors + // See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// - // This file is autogenerated by RedisCommandsBuilder + // This file is autogenerated by ValkeyCommandsBuilder import NIOCore - import Redis #if canImport(FoundationEssentials) import FoundationEssentials @@ -259,7 +258,7 @@ func renderRedisCommands(_ commands: [String: RedisCommand], replies: RESPReplie string.appendCommand(command: command, reply: reply, name: key, tab: "") } string.append("\n") - string.append("extension RedisConnection {\n") + string.append("extension ValkeyConnection {\n") for key in keys { let command = commands[key]! // if there is no reply info assume command is a container command @@ -282,7 +281,7 @@ private func enumName(names: [String]) -> String { names.map { $0.upperFirst() }.joined() } -private func parameterType(_ parameter: RedisCommand.Argument, names: [String], scope: String?, isArray: Bool) -> String { +private func parameterType(_ parameter: RESPCommand.Argument, names: [String], scope: String?, isArray: Bool) -> String { let variableType = variableType(parameter, names: names, scope: scope, isArray: isArray) if parameter.type == .pureToken { return variableType + " = false" @@ -298,7 +297,7 @@ private func parameterType(_ parameter: RedisCommand.Argument, names: [String], return variableType } -private func variableType(_ parameter: RedisCommand.Argument, names: [String], scope: String?, isArray: Bool) -> String { +private func variableType(_ parameter: RESPCommand.Argument, names: [String], scope: String?, isArray: Bool) -> String { var parameterString = parameter.type.swiftName if case .oneOf = parameter.type { parameterString = "\(scope.map {"\($0)."} ?? "")\(enumName(names: names + [parameter.name.swiftTypename]))" @@ -385,13 +384,13 @@ private func getReturnType(reply: some StringProtocol) -> String? { return nil } -extension RedisCommand.ArgumentType { +extension RESPCommand.ArgumentType { var swiftName: String { switch self { case .block: "#" case .double: "Double" case .integer: "Int" - case .key: "RedisKey" + case .key: "RESPKey" case .oneOf: "#" case .pattern: "String" case .pureToken: "Bool" @@ -401,12 +400,12 @@ extension RedisCommand.ArgumentType { } } -extension RedisCommand.Argument { - func redisRepresentable(isArray: Bool) -> String { +extension RESPCommand.Argument { + func respRepresentable(isArray: Bool) -> String { var variable = self.functionLabel(isArray: multiple && isArray) switch self.type { - case .pureToken: return "RedisPureToken(\"\(self.token!)\", \(variable))" + case .pureToken: return "RESPPureToken(\"\(self.token!)\", \(variable))" default: if self.type == .unixTime { if self.optional { diff --git a/Sources/RedisCommandsBuilder/app.swift b/Sources/ValkeyCommandsBuilder/app.swift similarity index 76% rename from Sources/RedisCommandsBuilder/app.swift rename to Sources/ValkeyCommandsBuilder/app.swift index a6f90924..2a05a1a7 100644 --- a/Sources/RedisCommandsBuilder/app.swift +++ b/Sources/ValkeyCommandsBuilder/app.swift @@ -9,12 +9,12 @@ struct App { func run() async throws { let resourceFolder = Bundle.module.resourceURL! - let commands = try load(fileURL: resourceFolder.appending(path: "commands.json"), as: RedisCommands.self) + let commands = try load(fileURL: resourceFolder.appending(path: "commands.json"), as: ValkeyCommands.self) let resp3Replies = try load(fileURL: resourceFolder.appending(path: "resp3_replies.json"), as: RESPReplies.self) - try writeRedisCommands(toFolder: "Sources/RedisCommands/", commands: commands, replies: resp3Replies) + try writeValkeyCommands(toFolder: "Sources/Valkey/Commands/", commands: commands, replies: resp3Replies) } - func writeRedisCommands(toFolder: String, commands: RedisCommands, replies: RESPReplies) throws { + func writeValkeyCommands(toFolder: String, commands: ValkeyCommands, replies: RESPReplies) throws { // get list of groups var groups: Set = .init() for command in commands.commands.values { @@ -22,7 +22,7 @@ struct App { } for group in groups { let commands = commands.commands.filter { $0.value.group == group } - let output = renderRedisCommands(commands, replies: replies) + let output = renderValkeyCommands(commands, replies: replies) let filename = "\(toFolder)\(group.swiftTypename)Commands.swift" try output.write(toFile: filename, atomically: true, encoding: .utf8) } diff --git a/Tests/RESPTests/RESPTokenTests.swift b/Tests/RESPTests/RESPTokenTests.swift index cce7a8df..b15e8915 100644 --- a/Tests/RESPTests/RESPTokenTests.swift +++ b/Tests/RESPTests/RESPTokenTests.swift @@ -1,12 +1,12 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // @@ -16,7 +16,7 @@ import NIOCore import NIOTestUtils import Testing -@testable import Redis +@testable import Valkey struct RESPTokenTests { @Test diff --git a/Tests/RedisTests/redisTests.swift b/Tests/ValkeyTests/ValkeyTests.swift similarity index 70% rename from Tests/RedisTests/redisTests.swift rename to Tests/ValkeyTests/ValkeyTests.swift index 6629c899..e0e451e4 100644 --- a/Tests/RedisTests/redisTests.swift +++ b/Tests/ValkeyTests/ValkeyTests.swift @@ -1,12 +1,12 @@ //===----------------------------------------------------------------------===// // -// This source file is part of the swift-redis open source project +// This source file is part of the swift-valkey open source project // -// Copyright (c) 2025 Apple Inc. and the swift-redis project authors +// Copyright (c) 2025 Apple Inc. and the swift-valkey project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-redis project authors +// See CONTRIBUTORS.txt for the list of swift-valkey project authors // // SPDX-License-Identifier: Apache-2.0 // @@ -14,16 +14,15 @@ import Foundation import Logging -import Redis -import RedisCommands import Testing +import Valkey -@testable import Redis +@testable import Valkey struct GeneratedCommands { - let redisHostname = ProcessInfo.processInfo.environment["REDIS_HOSTNAME"] ?? "localhost" - func withKey(connection: RedisConnection, _ operation: (RedisKey) async throws -> Value) async throws -> Value { - let key = RedisKey(rawValue: UUID().uuidString) + let valkeyHostname = ProcessInfo.processInfo.environment["VALKEY_HOSTNAME"] ?? "localhost" + func withKey(connection: ValkeyConnection, _ operation: (RESPKey) async throws -> Value) async throws -> Value { + let key = RESPKey(rawValue: UUID().uuidString) let value: Value do { value = try await operation(key) @@ -36,23 +35,23 @@ struct GeneratedCommands { } @Test - func testRedisCommand() async throws { - struct GET: RedisCommand { + func testValkeyCommand() async throws { + struct GET: RESPCommand { typealias Response = String? - var key: RedisKey + var key: RESPKey - init(key: RedisKey) { + init(key: RESPKey) { self.key = key } - func encode(into commandEncoder: inout RedisCommandEncoder) { + func encode(into commandEncoder: inout RESPCommandEncoder) { commandEncoder.encodeArray("GET", key) } } - var logger = Logger(label: "Redis") + var logger = Logger(label: "Valkey") logger.logLevel = .debug - try await RedisClient(.hostname(redisHostname, port: 6379), logger: logger).withConnection(logger: logger) { connection in + try await ValkeyClient(.hostname(valkeyHostname, port: 6379), logger: logger).withConnection(logger: logger) { connection in try await withKey(connection: connection) { key in _ = try await connection.set(key: key, value: "Hello") let response = try await connection.send(command: GET(key: key)) @@ -63,9 +62,9 @@ struct GeneratedCommands { @Test func testSetGet() async throws { - var logger = Logger(label: "Redis") + var logger = Logger(label: "Valkey") logger.logLevel = .debug - try await RedisClient(.hostname(redisHostname, port: 6379), logger: logger).withConnection(logger: logger) { connection in + try await ValkeyClient(.hostname(valkeyHostname, port: 6379), logger: logger).withConnection(logger: logger) { connection in try await withKey(connection: connection) { key in _ = try await connection.set(key: key, value: "Hello") let response = try await connection.get(key: key) @@ -76,9 +75,9 @@ struct GeneratedCommands { @Test func testUnixTime() async throws { - var logger = Logger(label: "Redis") + var logger = Logger(label: "Valkey") logger.logLevel = .debug - try await RedisClient(.hostname(redisHostname, port: 6379), logger: logger).withConnection(logger: logger) { connection in + try await ValkeyClient(.hostname(valkeyHostname, port: 6379), logger: logger).withConnection(logger: logger) { connection in try await withKey(connection: connection) { key in _ = try await connection.set(key: key, value: "Hello", expiration: .unixTimeMilliseconds(.now + 1)) let response = try await connection.get(key: key) @@ -92,9 +91,9 @@ struct GeneratedCommands { @Test func testPipelinedSetGet() async throws { - var logger = Logger(label: "Redis") + var logger = Logger(label: "Valkey") logger.logLevel = .debug - try await RedisClient(.hostname(redisHostname, port: 6379), logger: logger).withConnection(logger: logger) { connection in + try await ValkeyClient(.hostname(valkeyHostname, port: 6379), logger: logger).withConnection(logger: logger) { connection in try await withKey(connection: connection) { key in let responses = try await connection.pipeline( SET(key: key, value: "Pipelined Hello"), @@ -107,9 +106,9 @@ struct GeneratedCommands { @Test func testSingleElementArray() async throws { - var logger = Logger(label: "Redis") + var logger = Logger(label: "Valkey") logger.logLevel = .debug - try await RedisClient(.hostname(redisHostname, port: 6379), logger: logger).withConnection(logger: logger) { connection in + try await ValkeyClient(.hostname(valkeyHostname, port: 6379), logger: logger).withConnection(logger: logger) { connection in try await withKey(connection: connection) { key in _ = try await connection.rpush(key: key, element: ["Hello"]) _ = try await connection.rpush(key: key, element: ["Good", "Bye"]) @@ -121,9 +120,9 @@ struct GeneratedCommands { @Test func testCommandWithMoreThan9Strings() async throws { - var logger = Logger(label: "Redis") + var logger = Logger(label: "Valkey") logger.logLevel = .debug - try await RedisClient(.hostname(redisHostname, port: 6379), logger: logger).withConnection(logger: logger) { connection in + try await ValkeyClient(.hostname(valkeyHostname, port: 6379), logger: logger).withConnection(logger: logger) { connection in try await withKey(connection: connection) { key in let count = try await connection.rpush(key: key, element: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]) #expect(count == 10) @@ -135,9 +134,9 @@ struct GeneratedCommands { @Test func testSort() async throws { - var logger = Logger(label: "Redis") + var logger = Logger(label: "Valkey") logger.logLevel = .debug - try await RedisClient(.hostname(redisHostname, port: 6379), logger: logger).withConnection(logger: logger) { connection in + try await ValkeyClient(.hostname(valkeyHostname, port: 6379), logger: logger).withConnection(logger: logger) { connection in try await withKey(connection: connection) { key in _ = try await connection.lpush(key: key, element: ["a"]) _ = try await connection.lpush(key: key, element: ["c"]) @@ -150,20 +149,20 @@ struct GeneratedCommands { @Test("Array with count using LMPOP") func testArrayWithCount() async throws { - var logger = Logger(label: "Redis") + var logger = Logger(label: "Valkey") logger.logLevel = .debug - try await RedisClient(.hostname(redisHostname, port: 6379), logger: logger).withConnection(logger: logger) { connection in + try await ValkeyClient(.hostname(valkeyHostname, port: 6379), logger: logger).withConnection(logger: logger) { connection in try await withKey(connection: connection) { key in try await withKey(connection: connection) { key2 in _ = try await connection.lpush(key: key, element: ["a"]) _ = try await connection.lpush(key: key2, element: ["b"]) let rt1: [RESPToken] = try await connection.lmpop(key: [key, key2], where: .left)! - let keyReturned1 = try RedisKey(from: rt1[0]) + let keyReturned1 = try RESPKey(from: rt1[0]) let values1 = try [String](from: rt1[1]) #expect(keyReturned1 == key) #expect(values1.first == "a") let rt2: [RESPToken] = try await connection.lmpop(key: [key, key2], where: .left)! - let keyReturned2 = try RedisKey(from: rt2[0]) + let keyReturned2 = try RESPKey(from: rt2[0]) let values2 = try [String](from: rt2[1]) #expect(keyReturned2 == key2) #expect(values2.first == "b") @@ -176,10 +175,10 @@ struct GeneratedCommands { @Test func testSubscriptions() async throws { try await withThrowingTaskGroup(of: Void.self) { group in - var logger = Logger(label: "Redis") + var logger = Logger(label: "Valkey") logger.logLevel = .debug group.addTask { - try await RedisClient(.hostname("localhost", port: 6379), logger: logger).withConnection(logger: logger) { connection in + try await ValkeyClient(.hostname("localhost", port: 6379), logger: logger).withConnection(logger: logger) { connection in _ = try await connection.subscribe(channel: "subscribe") for try await message in connection.subscriptions { try print(message.converting(to: [String].self)) @@ -188,7 +187,7 @@ struct GeneratedCommands { } } group.addTask { - try await RedisClient(.hostname("localhost", port: 6379), logger: logger).withConnection(logger: logger) { connection in + try await ValkeyClient(.hostname("localhost", port: 6379), logger: logger).withConnection(logger: logger) { connection in while true { let subscribers = try await connection.pubsubNumsub(channel: "subscribe") if try subscribers[1].converting(to: Int.self) > 0 { break } diff --git a/docker-compose.yml b/docker-compose.yml index c4a376af..633084c0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,13 +1,13 @@ services: - redis: - image: redis:8.0-M03-alpine + valkey: + image: valkey/valkey:8.0 ports: - 6379:6379 healthcheck: - test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ] + test: [ "CMD", "valkey-cli", "--raw", "incr", "ping" ] volumes: - - redis_data:/data + - valkey_data:/data volumes: - redis_data: + valkey_data: