From fd34dd883981871d2c39bc38f6765a8044f7c91f Mon Sep 17 00:00:00 2001 From: Shweelan Samson Date: Mon, 19 Aug 2019 10:53:44 -0400 Subject: [PATCH] Return null in case of expired cache --- lib/cache.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cache.ts b/lib/cache.ts index 6da33eb..f7d25f1 100644 --- a/lib/cache.ts +++ b/lib/cache.ts @@ -62,7 +62,7 @@ export async function get(key): Promise { } else { const res = await mongoCollection.findOne({ _id: { $in: [key] } }); if (res && res["expire"] > expire) return res["value"]; - return res; + return null; } }