File size: 350 Bytes
40a9423
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { LRUCache } from "lru-cache";
import { SearchSummary } from "../types.js";

const cache = new LRUCache<string, SearchSummary>({
  max: 200,
  ttl: 1000 * 60 * 10
});

export function getCached(query: string) {
  return cache.get(query);
}

export function setCached(query: string, summary: SearchSummary) {
  cache.set(query, summary);
}