npm.io
0.8.2 • Published 7 months ago

@extra-memoize/blackglory-cache-service

Licence
MIT
Version
0.8.2
Deps
1
Size
24 kB
Vulns
0
Weekly
0

@extra-memoize/blackglory-cache-service

Install

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

API

AsyncCacheService
class AsyncCacheService<T> implements IAsyncCache<T> {
  constructor(
    client: CacheClient
  , namespace: string
  , options: {
      toJSONValue: (value: T) => JSONValue
      fromJSONValue: (json: JSONValue) => T

      timeToLive?: number | null = null
    }
  )
}
StaleWhileRevalidateAsyncCacheService
class StaleWhileRevalidateAsyncCacheService<T> implements IStaleWhileRevalidateAsyncCache<T> {
  constructor(
    client: CacheClient
  , namespace: string
  , options: {
      toJSONValue: (value: T) => JSONValue
      fromJSONValue: (json: JSONValue) => T

      timeToLive: number
      staleWhileRevalidate: number
    }
  )
}
StaleIfErrorAsyncCacheService
class StaleIfErrorAsyncCacheService<T> implements IStaleIfErrorAsyncCache<T> {
  constructor(
    client: CacheClient
  , namespace: string
  , options: {
      toJSONValue: (value: T) => JSONValue
      fromJSONValue: (json: JSONValue) => T

      timeToLive: number
      staleIfError: number
    }
  )
}
StaleWhileRevalidateAndStaleIfErrorAsyncCacheService
class StaleWhileRevalidateAndStaleIfErrorAsyncCacheService<T> implements IStaleWhileRevalidateAndStaleIfErrorAsyncCache<T> {
  constructor(
    client: CacheClient
  , namespace: string
  , options: {
      toJSONValue: (value: T) => JSONValue
      fromJSONValue: (json: JSONValue) => T

      timeToLive: number
      staleWhileRevalidate: number
      staleIfError: number
    }
  )
}