Options
All
  • Public
  • Public/Protected
  • All
Menu

Class KeysDependenciesEvictionPolicy<Key, Value, ArgumentsBundle>

Eviction policy, purpose of which is to offer cascade delete functionality.

When one of the keys is deleted/eviction, all of it's direct and transitive dependencies will also be deleted/evicted.

This is achieved by using an internal dependency graph. Graph is able to handle cycles.

When key is inserted in the cache, clients should also specify a list of dependencies and/or dependents (if key has them). The only limitation is that dependencies/dependents must be already present in the cache when they are specified, otherwise relationships of the key with them will be ignored.

Type parameters

Hierarchy

  • KeysDependenciesEvictionPolicy

Implements

Constructors

constructor

Methods

onClear

  • onClear(): void

onDelete

  • onDelete(entry: CacheEntryWithDependencies<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: CacheEntryWithDependencies<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: CacheEntryWithDependencies<Key, Value>, options?: ArgumentsBundle): void
  • Hook executed after entry for key has been set.

    Parameters

    • entry: CacheEntryWithDependencies<Key, Value>

      Entry that was inserted.

    • Optional options: ArgumentsBundle

      Arguments bundle for cache set operation.

    Returns void

onUpdate

  • onUpdate(): void

setDeleter

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