Interface TTLCacheManagerOptions

interface TTLCacheManagerOptions {
    capacity?: null | number;
    onCapacityExceeded?: ((key) => void | Promise<void>);
    onClear?: ((itemCount) => void | Promise<void>);
    onKeyAdd?: ((key) => void | Promise<void>);
    onKeyDelete?: ((key, reason?) => void | Promise<void>);
    onKeyExpire?: ((key) => void | Promise<void>);
    onKeyUpdate?: ((key) => void | Promise<void>);
    ttl?: number;
}

Hierarchy (view full)

Implemented by

Properties

capacity?: null | number

Maximum number of items to store in this cache

onCapacityExceeded?: ((key) => void | Promise<void>)

Callback to run when cache capacity is exceeded

Type declaration

    • (key): void | Promise<void>
    • Parameters

      • key: string

      Returns void | Promise<void>

onClear?: ((itemCount) => void | Promise<void>)

Callback to run when cache is cleared

Type declaration

    • (itemCount): void | Promise<void>
    • Parameters

      • itemCount: number

      Returns void | Promise<void>

onKeyAdd?: ((key) => void | Promise<void>)

Callback to run when a key is added

Type declaration

    • (key): void | Promise<void>
    • Parameters

      • key: string

      Returns void | Promise<void>

onKeyDelete?: ((key, reason?) => void | Promise<void>)

Callback to run when a key is deleted

Type declaration

    • (key, reason?): void | Promise<void>
    • Parameters

      • key: string
      • Optional reason: string

      Returns void | Promise<void>

onKeyExpire?: ((key) => void | Promise<void>)

Callback to run when a key expires

Type declaration

    • (key): void | Promise<void>
    • Parameters

      • key: string

      Returns void | Promise<void>

onKeyUpdate?: ((key) => void | Promise<void>)

Callback to run when a key is updated

Type declaration

    • (key): void | Promise<void>
    • Parameters

      • key: string

      Returns void | Promise<void>

ttl?: number

Time to live for data added to this cache