mathsteps-experimental-fork
Version:
Step by step math solutions. Experimental Fork
25 lines (22 loc) • 724 B
JavaScript
import { LRUCache } from '../node_modules/.pnpm/lru-cache@11.0.2/node_modules/lru-cache/dist/esm/index.js';
const MyNodeToStringCache = new LRUCache({
max: 5e3,
// Maximum number of items in the cache
ttl: 1e3 * 60 * 10,
// Time-to-live in milliseconds (10 minutes)
updateAgeOnGet: true,
// Refresh TTL on access
updateAgeOnHas: true,
// Refresh TTL on set
allowStale: false,
// Do not return stale items
// dispose: (key: any, value: any) => {
// console.log(`Evicted cache key: ${key}`)
// // Optional cleanup logic
// },
maxSize: 5e3,
// Maximum size of the cache in storage
sizeCalculation: (value) => value.length
// Use string length as size
});
export { MyNodeToStringCache };