All Projects → SwiftNIOExtras → swift-nio-redis

SwiftNIOExtras / swift-nio-redis

Licence: Apache-2.0 license
A high performance Redis protocol (RESP) implementation for SwiftNIO

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to swift-nio-redis

MicroExpress
A micro web server framework on top of Swift NIO
Stars: ✭ 125 (+362.96%)
Mutual labels:  swift-framework, asyncio, swift-server, swift-nio
swift-lambda-runtime
⚠️ Deprecated AWS Lambda Runtime - please use https://github.com/swift-server/swift-aws-lambda-runtime instead
Stars: ✭ 68 (+151.85%)
Mutual labels:  swift-server, swift-nio
Aredis
redis client for Python asyncio (has support for redis server, sentinel and cluster)
Stars: ✭ 576 (+2033.33%)
Mutual labels:  redis-client, asyncio
redi-s
A performant Redis server implemented in SwiftNIO.
Stars: ✭ 69 (+155.56%)
Mutual labels:  swift-server, swift-nio
aioredis-cluster
Redis Cluster support extension for aioredis
Stars: ✭ 21 (-22.22%)
Mutual labels:  redis-client, asyncio
Aioredis Py
asyncio (PEP 3156) Redis support
Stars: ✭ 2,003 (+7318.52%)
Mutual labels:  redis-client, asyncio
scala-redis
A scala library for connecting to a redis server, or a cluster of redis nodes using consistent hashing on the client side.
Stars: ✭ 1,016 (+3662.96%)
Mutual labels:  redis-client
zig-okredis
Zero-allocation Client for Redis 6+
Stars: ✭ 137 (+407.41%)
Mutual labels:  redis-client
redis-patterns-console
An interactive (and reactive) console to try and go into the deep of Redis and its patterns!
Stars: ✭ 22 (-18.52%)
Mutual labels:  redis-client
racket-redis
Fast, idiomatic Redis bidings for Racket.
Stars: ✭ 30 (+11.11%)
Mutual labels:  redis-client
vscode-redis
Redis Client in VSCode!
Stars: ✭ 63 (+133.33%)
Mutual labels:  redis-client
Sequents
A simple continuous animation library for iOS UI.
Stars: ✭ 31 (+14.81%)
Mutual labels:  swift-framework
node-cache-manager-redis-store
Redis store for node-cache-manager using node_redis.
Stars: ✭ 117 (+333.33%)
Mutual labels:  redis-client
node-redis
A high-performance Node.js Redis client.
Stars: ✭ 15,783 (+58355.56%)
Mutual labels:  redis-client
redis client
a redis client supports cluster
Stars: ✭ 72 (+166.67%)
Mutual labels:  redis-client
redimo.go
Use the power of DynamoDB with the ease of the Redis API
Stars: ✭ 29 (+7.41%)
Mutual labels:  redis-client
redis-rs
Redis client for Rust.
Stars: ✭ 25 (-7.41%)
Mutual labels:  redis-client
Shades
Easily add drop shadows, borders, and round corners to a UIView.
Stars: ✭ 14 (-48.15%)
Mutual labels:  swift-framework
retcl
Tcl client library for Redis
Stars: ✭ 20 (-25.93%)
Mutual labels:  redis-client
The-Overly-Complicated-Random-Number-Generator
An Overly Complex Random Number Generator, created to demystify how containers work.
Stars: ✭ 25 (-7.41%)
Mutual labels:  redis-client

SwiftNIO Redis

Swift5 macOS tuxOS Travis

SwiftNIO Redis is a Swift package that contains a high performance Redis protocol implementation for SwiftNIO. This is a standalone project and has no other dependencies but SwiftNIO.

Apart from the protocol implementation which can encode and decode RESP (REdis Serialization Protocol), we also provide a Redis client module build on top.

What is Redis? Redis is a highly scalable in-memory data structure store, used as a database, cache and message broker. For example it can be used to implement a session store backing a web backend using its "expiring keys" feature, or it can be used as a relay to implement a chat server using its builtin PubSub features.

This Swift package includes the RESP protocol implementation. A simple Redis client can be found on swift-nio-redis-client. We also provide an actual Redis Server written in Swift, using SwiftNIO and SwiftNIO Redis.

Performance

This implementation is focused on performance. It tries to reuse NIO ByteBuffers as much as possible to avoid copies.

The parser is based on a state machine, not on a buffering ByteToMessageDecoder/Encoder. That doesn't make it nice, but efficient ;-)

Importing the module using Swift Package Manager

An example Package.swift importing the necessary modules:

// swift-tools-version:5.0

import PackageDescription

let package = Package(
    name: "RedisTests",
    dependencies: [
        .package(url: "https://github.com/SwiftNIOExtras/swift-nio-redis.git", 
                 from: "0.9.2")
    ],
    targets: [
        .target(name: "MyProtocolTool",
                dependencies: [ "NIORedis" ])
    ]
)

Using the SwiftNIO Redis protocol handler

The RESP protocol is implemented as a regular ChannelHandler, similar to NIOHTTP1. It takes incoming ByteBuffer data, parses that, and emits RESPValue items. Same the other way around, the user writes RESPValue (or RESPEncodable) objects, and the handler renders such into ByteBuffers.

The NIORedis module has a litte more information.

To add the RESP handler to a NIO Channel pipeline, the configureRedisPipeline method is called, e.g.:

import NIORedis

bootstrap.channelInitializer { channel in
    channel.pipeline
        .configureRedisPipeline()
        .then { ... }
}

Status

The protocol implementation is considered complete. There are a few open ends in the telnet variant, yet the regular binary protocol is considered done.

Who

Brought to you by ZeeZide. We like feedback, GitHub stars, cool contract work, presumably any form of praise you can think of.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].