@extra-memoize/memory-cache
v0.2.10
Published
```sh npm install --save @extra-memoize/memory-cache # or yarn add @extra-memoize/memory-cache ```
Downloads
91
Readme
@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*/
)
}