UNPKG

transitory

Version:

In-memory cache with high hit rates via LFU eviction. Supports time-based expiration, automatic loading and metrics.

8 lines (6 loc) 258 B
import { KeyType } from '../KeyType'; /** * Decider for how long something stays cached. Takes in the key and the value * and should return a maximum age in milliseconds. */ export type MaxAgeDecider<K extends KeyType, V> = (key: K, value: V) => number;