cache.ts 244 B

12345678910
  1. import { LRUCache } from 'lru-cache'
  2. export function createCache<T extends {}>(
  3. max = 500,
  4. ): Map<string, T> | LRUCache<string, T> {
  5. if (__GLOBAL__ || __ESM_BROWSER__) {
  6. return new Map<string, T>()
  7. }
  8. return new LRUCache({ max })
  9. }