Belin.io Core
    Preparing search index...

    Implements an in-memory cache.

    Implements

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Removes the value associated with the specified key.

      Parameters

      • key: string

        The cache key.

      Returns Promise<void>

      Resolves when the value has been removed.

    • Gets the value associated with the specified key.

      Type Parameters

      • T

      Parameters

      • key: string

        The cache key.

      Returns Promise<null | T>

      The cached value, or null if the key does not exist.

    • Gets a value indicating whether this cache contains the specified key.

      Parameters

      • key: string

        The cache key.

      Returns Promise<boolean>

      true if this cache contains the specified key, otherwise false.

    • Associates a given value with the specified key.

      Parameters

      • key: string

        The cache key.

      • value: unknown

        The value to be cached.

      • duration: number = -1

        The number of seconds in which the cached value will expire.

      Returns Promise<MemoryCache>

      This instance.