Belin.io Core
    Preparing search index...

    Implements a cache using files.

    Implements

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    path: string

    The path of the directory to store cache files.

    Methods

    • Removes all entries from this cache.

      Returns Promise<void>

      Resolves when this cache has been cleared.

    • 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<FileCache>

      This instance.