0.0.4 • Published 4 years ago

@moonboot/plugin-redis v0.0.4

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

@moonboot/plugin-redis

What

A Project support redis for moon-boot

How to use

npm i @moonboot/plugin-redis Then you can use Redis with RedisTemplate RedisClusterTemplate as the following example.

// This Moudle will auto use when installed
// See project For More Information
// index.ts
import { start } from 'moon-boot'
class Main {
  constructor() {
    start(__dirname)
  }
}
new Main()
// service.ts
@Bean()
class TestService {
  @Autowired()
  redisTemplate!: RedisTemplate

  test() {
    this.redisTemplate.mget('abc', 'key')
  }
}

With npx

$ npx create-moon-boot use plugin-redis

Decorator

FAQ

Param

  1. redis.cluster = false useCluster or not, default is false
  2. redis... The config under redis will pass to new IoRedis() / new IoRedis.Cluster()