Skip to content

Commit

Permalink
rename defaultTTL to oneYearInMs
Browse files Browse the repository at this point in the history
  • Loading branch information
james-elicx committed Nov 18, 2024
1 parent cc9ad26 commit d12a709
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function getCacheStore() {
return new CacheAPIStore();
}

const defaultTTL = 31536000; // 1 year
const oneYearInMs = 31536000; // 1 year

class KVStore implements CacheStore {
constructor(private store: KVNamespace) {}
Expand All @@ -28,7 +28,7 @@ class KVStore implements CacheStore {
return this.store.get<CacheEntry>(key, "json");
}

put(key: string, entry: CacheEntry, ttl = defaultTTL) {
put(key: string, entry: CacheEntry, ttl = oneYearInMs) {
return this.store.put(key, JSON.stringify(entry), {
expirationTtl: ttl,
});
Expand All @@ -49,7 +49,7 @@ class CacheAPIStore implements CacheStore {
return null;
}

async put(key: string, entry: CacheEntry, ttl = defaultTTL) {
async put(key: string, entry: CacheEntry, ttl = oneYearInMs) {
const cache = await caches.open(this.name);

const response = new Response(JSON.stringify(entry), {
Expand Down

0 comments on commit d12a709

Please sign in to comment.