Class DataCache

Hierarchy

  • DataCache

Constructors

Properties

_accessKeysService: AccessKeysService
_cacheEnabled: boolean
_cacheService: CacheService
_defaultTTL: number
_dlsManager: DLSManager
_hit: number
_miss: number
_runtimeConfig: RuntimeConfig
_vertexTTL: VertexCacheConfig[]

Methods

  • This function adds an item to the cache.

    Parameters

    • context: KosmosUserContext<object>

      User context

    • module: string

      Module name

    • key: string

      Key of the item

    • value: any

      Value of the item

    Returns Promise<void>

  • This function checks if the user has access to the item it does this by checking the user access keys against the item access keys, it will be handled in future by OpenSearch DLS

    Parameters

    Returns Promise<boolean>

  • This function fetches an item from the cache. If the item is not in the cache, it will be fetched from the database and added to the cache.

    Returns

    Cached item or null

    Type Parameters

    Parameters

    • context: KosmosUserContext<object>

      User context

    • g: QueryFactory<any>
    • module: string

      Module name Vertex / AccessKey

    • key: string

      Unique key of the item

    • Optional fetchFunction: ((...args: any[]) => Promise<T>)

      Function to fetch the item.

        • (...args: any[]): Promise<T>
        • Parameters

          • Rest ...args: any[]

          Returns Promise<T>

    • Optional validateFunction: CacheItemValidator

    Returns Promise<undefined | null | T>

  • Get the TTL for a vertex type, if no TTL is set for the vertex type then the default TTL is returned.

    Returns

    ttl

    Parameters

    • vertexType: string

      The vertex type to get the TTL for

    Returns number

Generated using TypeDoc