Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LruCache<T>

Type parameters

  • T

Hierarchy

  • LruCache

Index

Constructors

constructor

  • new LruCache(capacity: number, costCallback?: undefined | function): LruCache
  • Parameters

    • capacity: number
    • Optional costCallback: undefined | function

    Returns LruCache

Methods

clear

  • clear(disposeCallback: function): void
  • Parameters

    • disposeCallback: function
        • (key: string, value: T): void
        • Parameters

          • key: string
          • value: T

          Returns void

    Returns void

get

  • get(key: string, missedCallback?: undefined | function): T | undefined
  • Parameters

    • key: string
    • Optional missedCallback: undefined | function

    Returns T | undefined

getCapacity

  • getCapacity(): number
  • Returns number

getTotalCost

  • getTotalCost(): number
  • Returns number

put

  • put(key: string, value: T, evictCallback?: undefined | function, abortIfFull?: boolean | undefined): boolean
  • Parameters

    • key: string
    • value: T
    • Optional evictCallback: undefined | function
    • Default value abortIfFull: boolean | undefined = false

    Returns boolean

    If some other item is evicted

recycle

  • recycle(key: string, disposeCallback?: undefined | function): boolean
  • Parameters

    • key: string
    • Optional disposeCallback: undefined | function

    Returns boolean