0.2.10 • Published 9 months ago

@extra-memoize/memory-cache v0.2.10

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

@extra-memoize/memory-cache

Install

npm install --save @extra-memoize/memory-cache
# or
yarn add @extra-memoize/memory-cache

API

Cache

class Cache<T> implements ICache<T> {
  clear(): void
}

LRUCache

class LRUCache<T> implements ICache<T> {
  constructor(limit: number)

  delete(key: string): void
  clear(): void
}

The classic LRU cache.

ExpirableCache

class ExpirableCache<T> implements ICache<T> {
  constructor(timeToLive: number /*ms*/)

  clear(): void
}

The classisc expirable cache.

ExpirableCacheWithStaleWhileRevalidate

class ExpirableCacheWithStaleWhileRevalidate<T> implements IStaleWhileRevalidateCache<T> {
  constructor(timeToLive: number /*ms*/, staleWhileRevalidate: number /*ms*/)
}

ExpirableCacheWithStaleIfError

class ExpirableCacheWithStaleIfError<T> implements IStaleIfErrorCache<T> {
  constructor(timeToLive: number /*ms*/, staleIfError: number /*ms*/)
}

ExpirableCacheWithStaleWhileRevalidateAndStaleIfError

class ExpirableCacheWithStaleWhileRevalidateAndStaleIfError<T> implements IStaleWhileRevalidateAndStaleIfErrorCache<T> {
  constructor(
    timeToLive: number /*ms*/
  , staleWhileRevalidate: number /*ms*/
  , staleIfError: number /*ms*/
  )
}

TLRUCache

class TLRUCache<T> implements ICache<T> {
  constructor(limit: number, timeToLive: number /*ms*/)

  clear(): void
}

The classic TLRU cache.

TLRUCacheWithStaleWhileRevalidate

class TLRUCacheWithStaleWhileRevalidate<T> implements IStaleWhileRevalidateCache<T> {
  constructor(limit: number, timeToLive: number /*ms*/, staleWhileRevalidate: number /*ms*/)
}

TLRUCacheWithStaleIfError

class TLRUCacheWithStaleIfError<T> implements IStaleIfErrorCache<T> {
  constructor(limit: number, timeToLive: number /*ms*/, staleIfError: number /*ms*/)
}

TLRUCacheWithStaleWhileRevalidateAndStaleIfError

class TLRUCacheWithStaleWhileRevalidateAndStaleIfError<T> implements IStaleWhileRevalidateAndStaleIfErrorCache<T> {
  constructor(
    limit: number
  , timeToLive: number /*ms*/
  , staleWhileRevalidate: number /*ms*/
  , staleIfError: number /*ms*/
  )
}
0.2.10

9 months ago

0.2.9

11 months ago

0.2.7

1 year ago

0.2.6

1 year ago

0.2.8

1 year ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.1

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago