Skip to content

Commit

Permalink
cache error
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhinav Dixit authored and Abhinav Dixit committed Nov 23, 2024
1 parent c27a78f commit f01f275
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/routes/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ router.get('/', userAuth, async (req, res) => {

const messages = await Message.find(query).sort({ timestamp: 1 });

await redisClient.set(cacheKey, JSON.stringify(messages), { EX: 60 * 5 });

await redisClient.set(cacheKey1, JSON.stringify(messagesCache), { EX: 60 * 5 });
await redisClient.set(cacheKey2, JSON.stringify(messagesCache), { EX: 60 * 5 });

res.status(200).json({ success: true, messages });
} catch (error) {
console.error("Server Error:", error);
Expand Down

0 comments on commit f01f275

Please sign in to comment.