File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Sources/RediStack/Commands
Tests/RediStackIntegrationTests/Commands Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -222,6 +222,12 @@ extension RedisCommand {
222
222
]
223
223
return . init( keyword: " SETNX " , arguments: args)
224
224
}
225
+
226
+ ///[STRLEN](https://redis.io/commands/strln)
227
+ /// - Parameter key: The key to fetch the length of.
228
+ public static func strln( _ key: RedisKey ) -> RedisCommand < Int > {
229
+ . init( keyword: " STRLEN " , arguments: [ . init( from: key) ] )
230
+ }
225
231
}
226
232
227
233
// MARK: -
Original file line number Diff line number Diff line change @@ -229,4 +229,10 @@ final class StringCommandsTests: RediStackIntegrationTestCase {
229
229
result = try connection. send ( . decrby( #function, by: 0 ) ) . wait ( )
230
230
XCTAssertEqual ( result, 7 )
231
231
}
232
+
233
+ func test_strlen( ) throws {
234
+ XCTAssertNoThrow ( try connection. set ( #function, to: " value " ) . wait ( ) )
235
+ let val = try connection. send ( . strln( #function) ) . wait ( )
236
+ XCTAssertEqual ( val, 5 )
237
+ }
232
238
}
You can’t perform that action at this time.
0 commit comments