Swiftpack.co - Package - bermudadigitalstudio/Redshot

RedShot

RedShot is a minimalistic Swift client library for the Redis database.

Redshot is dependency free.

Language Swift 4 Platforms CircleCI

Getting started

To add RedShot in your projects.

Add this in your Package.swift :

.Package(url: "https://github.com/bermudadigitalstudio/Redshot.git", majorVersion: 0)

You can connect to Redis by instantiating the Redis class :

import RedShot

let redis = try Redis(hostname: "localhost", port: 6379)

To connect to a password protected Redis instance, use:

let redis = try Redis(hostname: "localhost", port: 6379, password: "mypassword")

The Redis class exposes methods that are named identical to the commands they execute. The arguments these methods accept are often identical to the arguments specified on the Redis website. For instance, SET and GET commands can be called like this:

try redis.set(key: "mycounter", value: "479")

let myCounter = try redis.get(key: "mycounter") 
print(myCounter)

Running Unit Tests

RedShot's unit test require a running Redis database with a password.

Redis instance can be launch with Docker :

docker run -d -p 6379:6379 redis:latest --requirepass password123

Defaults

  • host: "localhost"
  • port: 6379

Source Code Linting

The source code is formatted using SwiftLint and all commits & PRs need to be without any SwiftLint warnings or errors.

License

RedShot is released under the MIT License.

Github

link
Stars: 2
Help us keep the lights on

Dependencies

Used By

Total: 1

Releases

0.2.0 - Jan 11, 2018

only swift 4 support

0.1.1 - Dec 15, 2017

Removes deprecated compiler warning for strings using the old .characters syntax