@lacunahub/lavaluna.js
    Preparing search index...

    Class DataManager<K, V>

    Manages a cache of key-value pairs.

    Type Parameters

    • K
    • V

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    cache: WishMap<K, V> = ...

    The underlying cache store.

    delete: (key: K) => boolean = ...

    Deletes an entry from the cache by key.

    Type Declaration

      • (key: K): boolean
      • Removes the specified element from the map.

        Parameters

        • key: K

        Returns boolean

        WishMap#delete

    find: (fn: (value: V, key: K) => boolean) => V = ...

    Finds a value in the cache matching the given predicate.

    Type Declaration

      • (fn: (value: V, key: K) => boolean): V
      • Returns the first value that passes the provided function.

        Parameters

        • fn: (value: V, key: K) => boolean

          Function to test each entry

        Returns V

    Methods

    • Adds a key-value pair to the cache if the key does not exist, and returns the value.

      Parameters

      • key: K

        The key to be added to the cache.

      • value: V

        The value to be associated with the key in the cache.

      Returns V

      The value associated with the key in the cache.