TtlCacheOptions

import { TtlCacheOptions } from "jsr:@ende/cache";

interface ยท experimental

interface TtlCacheOptions<K, V>

Options for the TtlCache constructor.

Properties

onEject

onEject?: (ejectedKey: K, ejectedValue: V) => void

Callback invoked when an entry is removed, whether by TTL expiry, manual deletion, or clearing the cache.

slidingExpiration

slidingExpiration?: boolean

When true, each get() call resets the entry's TTL.

If both slidingExpiration and absoluteExpiration are set on an entry, the sliding window cannot extend past the absolute expiration.

Default: false

Source