A redis backend for Juttle
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
test
.eslintrc
.gitignore
.istanbul.yml
.jscsrc
.travis.yml
README.md
package.json

README.md

Juttle Redis Adapter

Build Status

The Juttle Redis Adapter enables interaction with Redis. It works with Redis version 3.0 and above.

Examples

Write a Hash into Redis at the key my_hash with values a = 1, b = 2, c = 3:

emit -points [{ a: 1, b: 2, c: 3, id: 'my_hash' }]
    | put redis_write_command = 'HMSET ${id} a ${a} b ${b} c ${c} time ${time}'
    | write redis

Retrieve the value stored at my_hash:a above as the point {value: 1}:

read redis -raw "HGET my_hash a"

Installation

Like Juttle itself, the adapter is installed as a npm package. Both Juttle and the adapter need to be installed side-by-side:

$ npm install juttle
$ npm install juttle-redis-adapter

Configuration

The adapter needs to be registered and configured so that it can be used from within Juttle. To do so, add the following to your ~/.juttle/config.json file:

{
    "adapters": {
        "juttle-redis-adapter": {
            "host": "localhost",
            "port": 6379
        }
    }
}

To connect to a Redis instance elsewhere, change the address and port in this configuration.

Usage

Read options

Name Type Required Description Default
raw string yes redis command to run none

Write

write takes no options. It simply executes the Redis command stored in the redis_write_command field of each point it processes. To format the redis_write_command with fields from the point, use string templating as in the example.

Contributing

Want to contribute? Awesome! Don’t hesitate to file an issue or open a pull request.