Options
All
  • Public
  • Public/Protected
  • All
Menu

Class HeapGarbageCollector<T>

GarbageCollector which uses a binary min heap to keep entries that needs to be evicted.
Each heap node is represent by cache entry which contains expiration time.
Eviction timer is always synchronized with heap root and fires at expiration time of root entry. When it fires, will evict root and other nodes that have expiration time equal to root. After that, timer will fire again at the expiration time of the newest root.

Type parameters

  • T: HeapExpirableEntry

    Type of the cache entry.

Hierarchy

  • HeapGarbageCollector

Implements

Constructors

constructor

Accessors

idle

  • get idle(): boolean

size

  • get size(): number

Methods

clear

  • clear(): void

leave

  • leave(entry: T): void
  • Leaves entry without expiration, by un-managing it.

    Parameters

    • entry: T

    Returns void

manage

  • manage(entry: T): void

setEntryExpiredCallback

update

  • update(_oldExpiration: number, entry: T): void
  • Notify GC about expiration change of the managed entry.

    Parameters

    • _oldExpiration: number
    • entry: T

    Returns void