mirror of
https://github.com/swift-server/RediStack.git
synced 2026-06-02 07:37:33 +00:00
eaa9d2bfd0cb07d451ae7346f524dbd50dc499f9
Motivation: To be a comprehensive library, all commands should be implemented, even if they are highly discouraged. List's collection of commands were missing `brpop`, `blpop`, and `brpoplpush`. Modifications: `brpop`, `blpop` and `brpoplpush` are supported with defaults and overloads for an easier API. Result: Users now have access to `brpop`, `blpop` and `brpoplpush` commands.
NIORedis
A non-blocking Swift driver for Redis built with SwiftNIO.
This package defines everything you need to work with Redis through the Redis Seralization Protocol (RESP).
- Swift Server Working Group Proposal: SSWG-0004
Installation
To install NIORedis, just add the package as a dependency in your Package.swift
dependencies: [
.package(url: "https://github.com/Mordil/nio-redis.git", .upToNextMinor(from: "0.7.0")
]
and run the following command: swift package resolve
Getting Started
NIORedis is ready to use right after installation.
import NIORedis
let connection = Redis.makeConnection(
to: try .init(ipAddress: "127.0.0.1", port: 6379),
password: "my_pass"
).wait()
let result = try connection.set("my_key", to: "some value")
.flatMap { return connection.get("my_key" }
.wait()
print(result) // Optional("some value")
Contributing
Check out CONTRIBUTING.md for more information on how to help with NIORedis.
It is highly recommended to use Docker to install Redis locally.
docker run -d -p 6379:6379 --name nioredis redis:5
Otherwise, install Redis directly on your machine from Redis.io.
Languages
Swift
99.7%
Shell
0.3%