@moonboot/plugin-redis
v0.0.4
Published
> A Project support [redis](https://www.npmjs.com/package/ioredis) for `moon-boot`
Downloads
7
Readme
@moonboot/plugin-redis
What
A Project support redis for
moon-boot
How to use
npm i @moonboot/plugin-redis
Then you can use Redis withRedisTemplate
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
redis.cluster = false
useCluster or not, default isfalse
redis...
The config underredis
will pass tonew IoRedis() / new IoRedis.Cluster()