Swiftpack.co - Mordil/RediStack as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by Mordil.
Mordil/RediStack 2.0.0-experimental.1.1
Non-blocking, event-driven Swift client for Redis.
โญ๏ธ 73
๐Ÿ•“ 32 weeks ago
.package(url: "https://github.com/Mordil/RediStack.git", from: "2.0.0-experimental.1.1")

RediStack logo

SSWG Maturity Apache 2 License Swift 5.5+ Redis 5.0

pipeline status coverage report Documentation Coverage

The GitHub repository is a read-only mirror of the GitLab repository. For issues and merge requests, please visit GitLab.


RediStack (pronounced like "ready stack") is a non-blocking Swift client for Redis built on top of SwiftNIO.

It communicates over the network using Redis' Redis Seralization Protocol (RESP2).

This library is primarily developed for Redis v5, but is backwards compatible to Redis v3ยน.

The table below lists the major releases alongside their compatible language, dependency, and Redis versions.

RediStack Release Swift Redis SwiftNIO SwiftLog SwiftMetrics ServiceDiscovery
from: "1.0.0" 5.1+ 3.xยน ..< 6.x 2.x 1.x 1.x ..< 3.0 -
.branch("master") 5.2+ 3.xยน ... 6.x 2.x 1.x 1.x ..< 3.0 1.x

ยน Use of newer Redis features on older Redis versions is done at your own risk. See Redis' release notes for v6, v5, v4, and v3 for what is supported for each version of Redis.

Supported Operating Systems

RediStack runs anywhere that is officially supported by the Swift projectยฒ.

ยฒ See the platform support matrix below for more details.


To install RediStack, just add the package as a dependency in your Package.swift.

dependencies: [
    .package(url: "https://gitlab.com/mordil/RediStack.git", .branch("master"))

Getting Started

RediStack is quick to use - all you need is an EventLoop from SwiftNIO.

import NIO
import RediStack

let eventLoop: EventLoop = ...
let connection = RedisConnection.make(
    configuration: try .init(hostname: ""),
    boundEventLoop: eventLoop

let result = try connection.set("my_key", to: "some value")
    .flatMap { return connection.get("my_key") }

print(result) // Optional("some value")

Note: Use of wait() was used here for simplicity. Never call this method on an eventLoop!


The docs for the latest tagged release are always available from the Swift Package Index.


For bugs or feature requests, file a new issue.

For all other support requests, please email [email protected].

Security Vulnerabilities

If you think you have found a security flaw in the library, please report it following this project's Security Policy.

Project contributors will treat your report as top priority.


SemVer changes are documented for each release on the releases page.


Check out CONTRIBUTING.md for more information on how to help with RediStack.


Check out CONTRIBUTORS.txt to see the full list. This list is updated for each release.

Swift on Server Ecosystem

RediStack is part of the Swift on Server Working Group ecosystem - currently recommended as Sandbox Maturity.

Proposal Pitch Discussion Review Vote
SSWG-0004 2019-01-07 2019-04-01 2019-06-09 2019-06-27

Language and Platform Support

Any given release of RediStack will support at least the latest version of Swift on a given platform plus 2 previous versions, at the time of the release.

Major version releases will be scheduled around official Swift releases, taking no longer 3 months from the Swift release.

Major version releases will drop support for any version of Swift older than the last 3 Swift versions.

This policy is to balance the desire for as much backwards compatibility as possible, while also being able to take advantage of new Swift features for the best API design possible.

The following table shows the combination of Swift language versions and operating systems that receive regular unit testing (either in development, or with CI) against the current version of RediStack.

Platform Swift 5.5 5.6 5.7 Trunk
macOS Latest (M1) โœ…
Ubuntu 20.04 (Focal) โœ… โœ… โœ… โœ…
Ubuntu 18.04 (Bionic) โœ… โœ… โœ… โœ…
Ubuntu 16.04 (Xenial)ยณ โœ… โŒ โŒ โŒ
Amazon Linux 2 โœ… โœ… โœ… โœ…
CentOS 8ยณ โœ… โŒ โŒ โŒ
CentOS 7 โœ… โœ… โœ… โœ…

ยณ CentOS 8 and Ubuntu 16.04 are no longer officially supported by Swift after Swift 5.5.

For older versions of RediStack, view each summary below.

RediStack 1.x
Platform Swift 5.1 5.2 5.3
macOS Latest (Intel)
Ubuntu 20.04 (Focal) โœ… โœ…
Ubuntu 18.04 (Bionic) โœ… โœ… โœ…
Ubuntu 16.04 (Xenial) โœ… โœ… โœ…
Amazon Linux 2 โœ… โœ…
CentOS 7 โœ… โœ…
CentOS 8 โœ… โœ…


Apache 2.0

Copyright (c) 2019-present, Nathan Harris (@mordil)

This project contains code written by others not affliated with this project. All copyright claims are reserved by them. For a full list, with their claimed rights, see NOTICE.txt

Redis is a registered trademark of Redis Labs. Any use of their trademark is under the established trademark guidelines and does not imply any affiliation with or endorsement by them, and all rights are reserved by them.

Swift is a registered trademark of Apple, Inc. Any use of their trademark does not imply any affiliation with or endorsement by them, and all rights are reserved by them.


Stars: 73
Last commit: Yesterday
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

RediStack 2.0.0 Beta 1
16 weeks ago

API Docs are always available at docs.redistack.info

DocC documentation is now available from Swift Package Index.


  • Significantly refactored the RedisConnection.Configuration and RedisConnectionPool.Configuration APIs !176
  • Refactored Pub/Sub onSubscribe/onUnsubscribe callbacks to provide greater context to unsubscribe events !171
  • Swift 5.5 is now the minimum supported version !178


  • Added overload of PING command with no message arguments !172


  • addPubSubHandler now properly checks if handlers have been added/removed before executing logic to avoid deadlocks !173

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics