The options for a cache entry.

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

Properties

Properties

onDelete?: ((entry: unknown) => void)

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

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.