All files / src/cache updateRedisCache.js

80% Statements 4/5
100% Branches 0/0
66.66% Functions 2/3
80% Lines 4/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10      4x 4x 4x 4x      
import redisClient from "../configuration/redisClient.js";
 
export default async function updateRedisCache(key, updateFunction, options) {
    const currentData = await redisClient.get(key);
    const updatedData = updateFunction(JSON.parse(currentData));
    return await redisClient.set(key, JSON.stringify(updatedData), options)
        .then(() => true)
        .catch(() => false)
}