@defra/wls-eps-api
Version:
The API to support the wildlife licencing of European Protected Species
22 lines (20 loc) • 522 B
JavaScript
import { REDIS } from '@defra/wls-connectors-lib'
import { CACHE_EXPIRE_SECONDS } from '../constants.js'
export const cache = {
save: async (key, body) => {
const client = REDIS.getClient()
await client.set(key, JSON.stringify(body), {
EX: CACHE_EXPIRE_SECONDS
})
},
restore: async key => {
const client = REDIS.getClient()
return client.get(key, {
EX: CACHE_EXPIRE_SECONDS
})
},
delete: async key => {
const client = REDIS.getClient()
await client.GETDEL(key)
}
}