The options for a cache entry.

interface CacheOptions {
    onDelete?: ((entry) => void);
    size?: number;
    ttl?: number;
}

Properties

Properties

onDelete?: ((entry) => void)

A optional callback called when the entry is deleted from the cache.

Type declaration

    • (entry): void
    • Parameters

      • entry: unknown

      Returns void

size?: number

The entry size, in bytes. It does not have to be an exact value, but it helps the cache determine when to remove entries to save memory.

ttl?: number

The time to live of this entry, in milliseconds.