Swiftpack.co -  Mordil/RediStack as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Mordil/RediStack
Non-blocking, event-driven Swift client for Redis.
.package(url: "https://github.com/Mordil/RediStack.git", from: "2.0.0-alpha.3")

RediStack logo

SSWG Maturity Apache 2 License Swift 5.2+ Redis 5.0

Build Status Documentation Coverage

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

Introduction

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.

Installing

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: "127.0.0.1"),
    boundEventLoop: eventLoop
).wait()

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

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

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

Documentation

The docs for the latest tagged release are always available at docs.redistack.info.

Questions

For bugs or feature requests, file a new issue.

For all other support requests, please email support@redistack.info.

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.

Changelog

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

Contributing

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

Contributors

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.2 5.3 5.4 Trunk
macOS Latest (Intel)
Ubuntu 20.04 (Focal)
Ubuntu 18.04 (Bionic)
Ubuntu 16.04 (Xenial)
Amazon Linux 2
CentOS 8
CentOS 7

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

License

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.

GitHub

link
Stars: 58
Last commit: 4 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

RediStack 1.2.0
4 weeks ago

API Docs are always available at docs.redistack.info

Minor

  • RedisConnection now has an onUnexpectedClosure callback property that can be used to respond to unexpected connection closures #95
    let connection: RedisConnection
    connection.onUnexpectedClosure = { cleanup() }
    

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