@soluzioni-futura/redis-component
v1.0.0
Published
A redis utility ## Quick start
Downloads
2
Keywords
Readme
redis-component
A redis utility
Quick start
Install the package
$ npm i @soluzioni-futura/redis-component
Usage
Simple example
import RedisComponent from "@soluzioni-futura/redis-component"
const redisComponent = new RedisComponent({
host: provess.env.REDIS_HOST
})
const redis = redisComponent.asyncRedisClient
const importTtl = 30 * 60 // 30min
const key = "MARIO_ROSSI"
Set data
const user = {
name: "Mario",
lastname: "Rossi",
age: 25
}
await redis.set(key, JSON.stringify(user), "EX", importTtl)
Get data
const user = await redis.get(key)
Delete tata
await redis.del(key)