I'm trying to figure out the most efficient way to clear multiple keys using array of userIds for my auction site.
When a user places a bid on a specific auction then their userId gets added to array of bidders on that specific auction. The key is used for the active bids page. If a user places a bid, then the other bidders in the biddingGroup need to have their keys cache cleared. The only way I can think of doing it is to
for (let i = 0; i < biddingGroup.length; i++) {
redisConnection.client.del("active-bid-" + biddingGroup[i], function (err, response) {
if (response == 1) {
console.log("Deleted active bid pages from cache")
} else {
console.log("Cannot delete")
}
})
}
but I feel this is inefficient. Is there a better way? I appreciate any help!