1.0.3 • Published 5 years ago

semo-plugin-redis v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
5 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

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.12

5 years ago

0.0.13

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago