Options
All
  • Public
  • Public/Protected
  • All
Menu
classdesc

Creates a CacheManager

description

The CacheManager Class. Manages Cached items in memory and in storage

since

2.0.0

Hierarchy

  • CacheManager

Index

Constructors

constructor

Properties

Protected cache

cache: {}

Type declaration

  • [key: string]: string

storageIdentifier

storageIdentifier: string
memberof

CacheManager

description

Added start of every key that is stored in the localStorage, defaults to "DuckEngine_CacheManager_${key}"

since

2.0.0

Accessors

entries

  • get entries(): {}
  • memberof

    CacheManager

    description

    Returns the memory-cache entries as an object, calls CacheManager.sync

    since

    2.0.0

    Returns {}

    • [key: string]: string

Methods

delete

  • delete(name: string): void
  • memberof

    CacheManager

    description

    Deletes a Key-Value pair from the memory-cache and storage

    since

    2.0.0

    Parameters

    • name: string

      Name/Key to use to delete the pair

    Returns void

each

  • each(cb: (key: string, value: string) => any): void
  • memberof

    CacheManager

    description

    Loops through each entry in the memory-cache

    since

    2.0.0

    Parameters

    • cb: (key: string, value: string) => any

      Callback function

        • (key: string, value: string): any
        • Parameters

          • key: string
          • value: string

          Returns any

    Returns void

get

  • get(name: string): undefined | null | string
  • memberof

    CacheManager

    description

    Gets a value from a Name/Key from the storage or memory-cache

    since

    2.0.0

    Parameters

    • name: string

      Name/Key to get the value from

    Returns undefined | null | string

has

  • has(name: string): boolean
  • memberof

    CacheManager

    description

    Gets a Key-Value pair from the storage or memory-cache and returns based on if it exists or not

    since

    2.0.0

    Parameters

    • name: string

      Name/Key to save the value to

    Returns boolean

keys

  • keys(): string[]

set

  • set(name: string, value: string): void
  • memberof

    CacheManager

    description

    Sets a Key-Value pair in the memory-cache and storage

    since

    2.0.0

    Parameters

    • name: string

      Name/Key to save the value to

    • value: string

      Value to save to the Name/Key

    Returns void

sync

  • sync(): void

values

  • values(): string[]

Generated using TypeDoc