2.1.0 • Published 4 years ago
@verdigris/nitrous-driver-redis v2.1.0
nitrous-driver-redis
Redis driver for nitrous.js.
Usage
This is a plugin to nitrous.js. Make sure it is already installed as a dependency to your project.
Getting started
To use this driver, run:
npm install --save @verdigris/nitrous-driver-redis
Then in your code, import the package:
JavaScript
const { Cache } = require("@verdigris/nitrous");
const Redis = require("@verdigris/nitrous-driver-redis");
const options = {
url: "redis://localhost:6379/0",
};
const cache = new Cache(new Redis(options));
TypeScript
import { Cache } from "@verdigris/nitrous";
import Redis from "@verdigris/nitrous-driver-redis";
const options = {
url: "redis://localhost:6379/0",
};
const cache = new Cache(new Redis(options));
Accessing underlying Redis client
The driver exposes the underlying Redis client through client
property:
JavaScript
const Redis = require("@verdigris/nitrous-driver-redis");
const redis = new Redis({ url: "redis://localhost:6379/0" });
// Call raw Redis LOLWUT command: https://redis.io/commands/lolwut
redis.client.lolwut((version) => console.log(version));
TypeScript
import Redis from "@verdigris-nitrous-driver-redis";
const redis = new Redis({ url: "redis://localhost:6379/0" });
// Call raw Redis LOLWUT command: https://redis.io/commands/lolwut
redis.client.lolwut((version) => console.log(version));
For more information on the Redis client, see: Node Redis documentation.
Copyright © 2020 Verdigris Technologies Inc. All rights reserved.