1.0.0 • Published 2 years ago
lia-redis v1.0.0
Redis Installer
Simplify the use of Redis
Installer
Using npm:
$ npm install lia-redisHow to Use RedisInstaller
1.1 Redis Initial (single mode)
import {RedisInstaller,RedisConfig} from "lia-redis";
const TARGET = {};
const config = {
host: "127.0.0.1",
port: 6379
}
const installer = new RedisInstaller(config,TARGET,'sys|info');
await installer.load();1.2 Redis Use (single mode)
await TARGET.REDIS.SET('KEY','Hello')
const result = await TARGET.REDIS.GET('KEY')
console.log(result);2.1 Redis Initial (multi mode)
import {RedisInstaller,RedisConfig,RedisConfigs} from "lia-redis";
const TARGET = {};
const config = {
APP1:{
host: "127.0.0.1",
port: 6379
}
}
const installer = new RedisInstaller(config,TARGET,'sys|info');
await installer.load();2.2 Redis Use (multi mode)
The multi-instance mode is basically the same as the single-instance mode, except that the database instance needs to be specified on the REDIS instance, for example:
query
await TARGET.REDIS.APP1.SET('KEY','Hello')
const result = await TARGET.REDIS.APP1.GET('KEY')
console.log(result);For other operations, please refer to redis
1.0.0
2 years ago