0.1.1 • Published 4 years ago

flitter-redis v0.1.1

Weekly downloads
4
License
MIT
Repository
-
Last release
4 years ago

flitter-redis

Flitter-Redis is a lightweight wrapper around IORedis. It simply provides a configuration file for IORedis and makes a connection available as a service method.

Getting Started

Install

yarn add flitter-redis

Add the RedisUnit to Units.flitter.js, under "Pre-Routing Custom Units":

'Redis'         : require('./redis/src/RedisUnit'),

Deploy & Config

Run the deployment to create the configuration file:

./flitter deploy redis

Now edit the server configuration as necessary in the config/redis.config.js file.

Basic Usage

You can get the instance of the IORedis client from the redis service in any injectable class. For example, in a controller:

class SomeController extends Controller {
    static get services() {
        return [...super.services, 'redis']
    }

    async some_method(...args) {
        const redis_client = this.redis.client()
        await redis_client.set('hello', 'world!')
        console.log(await redis_client.get('hello')) // => world!
    }
}

See the IORedis docs for more usage information.

0.1.1

4 years ago

0.1.0

4 years ago