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:
RedShot
RedShot is a minimalistic Swift client library for the Redis database.
Redshot is dependency free.
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 :To connect to a password protected Redis instance, use:
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
andGET
commands can be called like this: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.