Popularity
1.7
Stable
Activity
0.0
Stable
28
7
16

Code Quality Rank: L3
Programming language: Swift
License: Apache License 2.0
Tags: Database    
Latest version: v3.4.1

Redis alternatives and similar libraries

Based on the "Database" category.
Alternatively, view Redis alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of Redis or a related project?

Add another 'Database' Library

README

Perfect-Redis [็ฎ€ไฝ“ไธญๆ–‡](README.zh_CN.md)

Redis client support for Perfect

Quick Start

Get a redis client with defaults (localhost, default port):

let client = RedisClient.getClient(withIdentifier: RedisClientIdentifier())

Ping the server:

let response = client.ping()
guard case .simpleString(let s) = response else {
    return
}
XCTAssert(s == "PONG", "Unexpected response \(response)")

Set/get a value:

let (key, value) = ("mykey", "myvalue")
var response = client.set(key: key, value: .string(value))
guard case .simpleString(let s) = response else {
    ...
    return
}
response = client.get(key: key)
guard case .bulkString = response else {
    ...
    return
}
let s = response.toString()
XCTAssert(s == value, "Unexpected response \(response)")

Pub/sub with two clients using async API:

RedisClient.getClient(withIdentifier: RedisClientIdentifier()) {
    c in
    do {
        let client1 = try c()
        RedisClient.getClient(withIdentifier: RedisClientIdentifier()) {
            c in
            do {
                let client2 = try c()
                client1.subscribe(channels: ["foo"]) {
                    response in
                    client2.publish(channel: "foo", message: .string("Hello!")) {
                        response in
                        client1.readPublished(timeoutSeconds: 5.0) {
                            response in
                            guard case .array(let array) = response else {
                                ...
                                return
                            }
                            XCTAssert(array.count == 3, "Invalid array elements")
                            XCTAssert(array[0].toString() == "message")
                            XCTAssert(array[1].toString() == "foo")
                            XCTAssert(array[2].toString() == "Hello!")
                        }
                    }
                }
            } catch {
                ...
            }
        }
    } catch {
        ...
    }
}

Building

Add this project as a dependency in your Package.swift file.

.package(url: "https://github.com/PerfectlySoft/Perfect-Redis.git", from: "3.2.3")

Further Information

For more information on the Perfect project, please visit perfect.org.


*Note that all licence references and agreements mentioned in the Redis README section above are relevant to that project's source code only.