code update recorded at: 13/01/25 08:19:19

This commit is contained in:
Sameer Dev 2025-01-13 08:19:19 +00:00
parent fa1780a61f
commit cd690f0bcf

View File

@ -162,12 +162,12 @@ export const handler = async (req, res) => {
const { command, key, value, ttl, secretData } = body; const { command, key, value, ttl, secretData } = body;
const client = await getOrCreateConnection({ secretData }); const client = await getOrCreateConnection({ secretData });
console.log("ttl", ttl, ttl || 0)
var result var result
if (command === "GET") { if (command === "GET") {
result = await client.get(key); result = await client.get(key);
} else if (command === "SET") { } else if (command === "SET") {
result = await client.set(key, value, "EX", ttl || 0); result = ttl ? await client.set(key, value, "EX", ttl) : await client.set(key, value);
} }
console.log('Command executed successfully:', JSON.stringify(result)); console.log('Command executed successfully:', JSON.stringify(result));