setex redis nodejs code example
Example: nodejs redis setex
async function upsert(table, data) {
let key = table;
if (data && data.id) {
key = key + '_' + data.id;
}
client.setex(key, 10, JSON.stringify(data));
return true;
}
async function upsert(table, data) {
let key = table;
if (data && data.id) {
key = key + '_' + data.id;
}
client.setex(key, 10, JSON.stringify(data));
return true;
}