1.0.3 • Published 4 years ago

semo-plugin-redis v1.0.3

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

semo-plugin-redis

A Semo plugin to provide integration with Redis.

Usage

$ npm i semo-plugin-redis
$ semo help
$ semo redis <cmd> [arguments..] --redisKey redisKey  redis access tool
$ semo redis set hello world
$ semo redis get hello
$ semo redis ttl hello

Programming

设置 .semorc.yml

semo-plugin-redis:
  redisKey: redis
  connection:
    redis:
      host: 127.0.0.1
      port: 6379

或者用钩子的方式声明配置:

export const hook_redis_connection = async () => {
  return {
    redis2: {
      host: '127.0.0.1',
      port: 6379
    }
  }
}

支持 Promise,所以也可以在这里去跟配置中心要配置。

代码中使用:

import { redis } from 'semo-plugin-redis'

const cache = await redis.load('redisKey')
await cache.set('hello', 'world')
const ret = cache.get('hello')

License

MIT

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.0.12

4 years ago

0.0.13

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago