Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GenericCache<T>

Generic cache class. Fetches information of a specific type from Knora once and caches it. Fetches also dependencies of a requested element (non-blocking). Works also with multiple async requests for the same key, also if not cached yet.

Type parameters

  • T

Hierarchy

Index

Methods

Protected Abstract getDependenciesOfItem

  • getDependenciesOfItem(item: T): string[]
  • Given an item, determines its dependencies on other items.

    Parameters

    • item: T

      the item whose dependencies have to be determined.

    Returns string[]

    keys of the items the current item relies on.

Protected getItem

  • getItem(key: string, isDependency?: boolean): AsyncSubject<T>
  • Gets a specific item from the cache. If not cached yet, the information will be fetched from Knora.

    Parameters

    • key: string

      the id of the item to be returned.

    • Default value isDependency: boolean = false

      true if the item to be returned is a dependency of another item (recursive call to this method).

    Returns AsyncSubject<T>

    the requested item.

Protected Abstract getKeyOfItem

  • getKeyOfItem(item: T): string
  • Given an item, determines its key.

    Parameters

    • item: T

      The item whose key has to be determined.

    Returns string

Protected reloadItem

  • reloadItem(key: string): AsyncSubject<T>
  • Deletes an existing entry in the cache and requests information from Knora.

    Parameters

    • key: string

      the id of the information to be returned.

    Returns AsyncSubject<T>

    the item.

Protected Abstract requestItemFromKnora

  • requestItemFromKnora(key: string, isDependency: boolean): Observable<T[]>
  • Fetches information from Knora.

    Parameters

    • key: string

      the id of the information to be returned.

    • isDependency: boolean

      true if the requested key is a dependency of another item.

    Returns Observable<T[]>

    the items received from Knora.

Generated using TypeDoc