An IORedis config wrapper for Flitter.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Garrett Mills 9a8011b1ad
v0.1.1
1 month ago
deploy/config Initial commit 1 month ago
src Add missing ioredis dep; check for config before create client 1 month ago
.gitignore Initial commit 1 month ago
README.md Initial commit 1 month ago
package.json v0.1.1 1 month ago
yarn.lock Add missing ioredis dep; check for config before create client 1 month ago

README.md

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.