Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LRUBinning

A file system cache based on npm's cacache using LRUBinning for lifecycle management.

Make sure to close() after use to remove the cache files.

Hierarchy

Implements

Index

Constructors

constructor

  • new LRUBinning(cacheDir: string, maxBinSize?: number, maxBinEntries?: number, minWritablePortion?: number): LRUBinning
  • Parameters

    • cacheDir: string
    • Default value maxBinSize: number = toMebibytes(50)
    • Default value maxBinEntries: number = 10000
    • Default value minWritablePortion: number = 0.2

    Returns LRUBinning

Properties

cacheType

cacheType: "async" = "async"

Optional coldBin

coldBin: Cache

maxBinEntries

maxBinEntries: number

maxBinSize

maxBinSize: number

minWritablePortion

minWritablePortion: number

newCache

newCache: () => Cache

Type declaration

protectedBin

protectedBin: Cache

writableBin

writableBin: Cache

Accessors

count

  • get count(): number
  • Returns number

dataSize

  • get dataSize(): number

maxProtectedBinSize

  • get maxProtectedBinSize(): number

Methods

close

  • close(): void

delete

  • delete(key: string | Buffer): Promise<void>

get

  • get(key: Buffer | string): Promise<Buffer | undefined>
  • Parameters

    • key: Buffer | string

    Returns Promise<Buffer | undefined>

rotate

  • rotate(): void

set

  • set(key: string, value: Buffer): Promise<void>
  • Parameters

    • key: string
    • value: Buffer

    Returns Promise<void>

Generated using TypeDoc