1
0
Fork 0
mirror of synced 2024-07-11 01:06:04 +12:00

Add bulk store

This commit is contained in:
Adria Navarro 2024-03-05 16:46:33 +01:00
parent a4288a9dd3
commit 49db47e1fd

View file

@ -279,6 +279,19 @@ class RedisWrapper {
}
}
async bulkStore(
data: Record<string, any>,
expirySeconds: number | null = null
) {
const client = this.getClient()
const dataToStore = Object.entries(data).reduce((acc, [key, value]) => {
acc[addDbPrefix(this._db, key)] = value
return acc
}, {} as Record<string, any>)
await client.mset(dataToStore)
}
async getTTL(key: string) {
const db = this._db
const prefixedKey = addDbPrefix(db, key)