Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface PriorityEvictionPolicyOptions<Key, Value>

Type parameters

  • Key

  • Value

Hierarchy

  • PriorityEvictionPolicyOptions

Properties

Optional cacheEvictionPercentage

cacheEvictionPercentage: number

Percentage of cache entries that needs to be evicted when PriorityEvictionPolicyOptions.criticalAvailableMemoryPercentage is reached.
Defaults to 20%.

Optional checkInterval

checkInterval: number

Interval for checking whether process is low on memory.
Defaults to 3600 seconds.

Optional criticalAvailableMemoryPercentage

criticalAvailableMemoryPercentage: number

Percentage of the available memory which is considered to be critical.
When process reaches it or goes bellow, cache entries eviction kicks in on next PriorityEvictionPolicyOptions.checkInterval.
Percentage is calculated by the following formula: ((heapTotal - heapUsed) * 100) / heapTotal.

⚠️ WARNING ⚠ Computation of the available memory doesn't take into account garbage collection and is subject to false positive results. GC is performed in a stop the world fashion, hence it's delayed by V8 as much as possible and performed when it's really needed, i.e. when process is low on memory.
Therefore, there is always a small chance that we will run our eviction handler and detect high memory usage before GC will occur.

Defaults to 20%.

iterableCacheBackend

iterableCacheBackend: IterableCacheBackend<Key, Value>

Iterable cache backend.