Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PriorityEvictionPolicy<Key, Value, ArgumentsBundle>

CacheReplacementPolicy which evicts entries when NodeJS process is low on memory.
Eviction is based on CacheEntryPriority and is performed in a stop the world way, as it will iterate over cache entries to determine which ones needs to ne evicted based on their priority.

Type parameters

  • Key

    Type of the key.

  • Value

    Type of the value.

  • ArgumentsBundle: PriorityEvictionPolicyArgumentsBundle

    Type of the arguments bundle.

Hierarchy

  • PriorityEvictionPolicy

Implements

Constructors

constructor

Accessors

idle

  • get idle(): boolean
  • Whether eviction timer has been started.

    Returns boolean

Methods

onClear

  • onClear(): void

onDelete

  • onDelete(entry: PrioritizedCacheEntry<Key, Value>): void
  • Hook executed before entry for key has been deleted.
    Policy is supposed to detach metadata from entry and cleanup it's internal data structures when this hook is called.

    Parameters

    • entry: PrioritizedCacheEntry<Key, Value>

      Entry that's being deleted.

    Returns void

onHit

  • Hook executed after entry for key was retrieved.
    Policy might decide that entry is no longer valid and return EntryValidity.NOT_VALID. In case it does so, policy is responsible to evict entry from cache before this method returns.

    Returns EntryValidity

    Whether entry is still valid.

onMiss

  • onMiss(): void

onSet

  • onSet(entry: PrioritizedCacheEntry<Key, Value>, options?: ArgumentsBundle): void
  • Hook executed after entry for key has been set.

    Parameters

    • entry: PrioritizedCacheEntry<Key, Value>

      Entry that was inserted.

    • Optional options: ArgumentsBundle

      Arguments bundle for cache set operation.

    Returns void

onUpdate

  • onUpdate(entry: PrioritizedCacheEntry<Key, Value>, options?: ArgumentsBundle): void
  • Hook executed after value for entry associated with key has been updated.

    Parameters

    • entry: PrioritizedCacheEntry<Key, Value>

      Entry that was update.

    • Optional options: ArgumentsBundle

      Arguments bundle for cache set operation.

    Returns void

setDeleter

  • setDeleter(deleter: Deleter<Key, Value>): void