npm install --save @extra-memoize/memory-cache
# or
yarn add @extra-memoize/memory-cache
class Cache<T> implements ICache<T> {
clear(): void
}
class LRUCache<T> implements ICache<T> {
constructor(limit: number)
delete(key: string): void
clear(): void
}
The classic LRU cache.
class ExpirableCache<T> implements ICache<T> {
constructor(timeToLive: number /*ms*/)
clear(): void
}
The classisc expirable cache.
class ExpirableCacheWithStaleWhileRevalidate<T> implements IStaleWhileRevalidateCache<T> {
constructor(timeToLive: number /*ms*/, staleWhileRevalidate: number /*ms*/)
}
class ExpirableCacheWithStaleIfError<T> implements IStaleIfErrorCache<T> {
constructor(timeToLive: number /*ms*/, staleIfError: number /*ms*/)
}
class ExpirableCacheWithStaleWhileRevalidateAndStaleIfError<T> implements IStaleWhileRevalidateAndStaleIfErrorCache<T> {
constructor(
timeToLive: number /*ms*/
, staleWhileRevalidate: number /*ms*/
, staleIfError: number /*ms*/
)
}
class TLRUCache<T> implements ICache<T> {
constructor(limit: number, timeToLive: number /*ms*/)
clear(): void
}
The classic TLRU cache.
class TLRUCacheWithStaleWhileRevalidate<T> implements IStaleWhileRevalidateCache<T> {
constructor(limit: number, timeToLive: number /*ms*/, staleWhileRevalidate: number /*ms*/)
}
class TLRUCacheWithStaleIfError<T> implements IStaleIfErrorCache<T> {
constructor(limit: number, timeToLive: number /*ms*/, staleIfError: number /*ms*/)
}
class TLRUCacheWithStaleWhileRevalidateAndStaleIfError<T> implements IStaleWhileRevalidateAndStaleIfErrorCache<T> {
constructor(
limit: number
, timeToLive: number /*ms*/
, staleWhileRevalidate: number /*ms*/
, staleIfError: number /*ms*/
)
}