Package -

Kitura-Session-Redis

Kitura-Session store using Redis as the backing store

Build Status Mac OS X Linux Apache 2

Summary

Kitura-Session store using Redis as the backing store

Table of Contents

Swift version

The latest version of Kitura-Session-Redis requires Swift 4.0.2. You can download this version of the Swift binaries by following this link. Compatibility with other Swift versions is not guaranteed.

API

In order to use Redis as session store, create an instance of RedisStore, and pass it to Session constructor:

import KituraSession
import KituraSessionRedis

let redisStore = RedisStore(redisHost: host, redisPort: port, redisPassword: password)
let session = Session(secret: <secret>, store: redisStore)

RedisStore constructor requires Redis server host and port. The rest of the parameters are optional:

init (redisHost: String, redisPort: Int32, redisPassword: String?=nil, ttl: Int = 3600, db: Int = 0, keyPrefix: String = "s:")

You can set Redis password in redis.conf file:

requirepass <your password>

The maximum number of databases is also set in redis.conf file:

databases <number of databases>

The db passed to the constructor must be between 0 and this number minus 1.

License

This library is licensed under Apache 2.0. Full license text is available in LICENSE.

Github

link
Stars:

Advertisement