Skip to content

Commit

Permalink
use Date.now() instead of constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
ujjwalguptaofficial committed Jan 26, 2025
1 parent 28f5e9a commit 9071d29
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/cache_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class CacheManager {
async set(key: any, data: any, ttl = 600) {
const cacheData = {
data,
expiry: new Date().getTime() + ttl * 1000,
expiry: Date.now() + ttl * 1000,
key: key
} as ICacheData;
await this.cacheStore_.set(cacheData);
Expand All @@ -33,7 +33,7 @@ export class CacheManager {
async get(key: any) {
const value = await this.cacheStore_.get(key);
if (value) {
if (new Date().getTime() > value.expiry) {
if (Date.now() > value.expiry) {
await this.delete(key);
return;
}
Expand Down

0 comments on commit 9071d29

Please sign in to comment.