Optionaloptions: { ttl?: number; bytes?: number }
The cache options, all optional
Optional Readonlyttl?: numberThe number of milliseconds a value is retained for after its last use, dropping it once they
elapse; a value less than or equal to 0 retains values indefinitely, as the default does
Optional Readonlybytes?: numberThe total number of value bytes to be retained, dropping the least recently used values beyond
that; a value less than or equal to 0 leaves the cache unbounded, as the default does
A fresh, immutable Bucket holding values in the process heap, as createMemoryBucket defines
Creates a memory cache.
Values are held in the process heap, so that content is cached with no external service and no setup, at the price of being confined to the process that stored it and lost when that process exits: caches created apart hold their content apart, however alike they were set up.
Called with no options, the cache retains every value for the life of the process; given a time to live, values left unused for longer are dropped; given a byte budget, values beyond it are dropped in least recently used order, so that a long-running job neither keeps serving content the source has since moved on from nor exhausts the heap.