An open API service indexing awesome lists of open source software.

https://github.com/extra-memoize/blackglory-cache-service

🌿
https://github.com/extra-memoize/blackglory-cache-service

browser esm library nodejs npm-package typescript

Last synced: 8 months ago
JSON representation

🌿

Awesome Lists containing this project

README

          

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

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

timeToLive?: number | null = null
}
)
}
```

### StaleWhileRevalidateAsyncCacheService
```ts
class StaleWhileRevalidateAsyncCacheService implements IStaleWhileRevalidateAsyncCache {
constructor(
client: CacheClient
, namespace: string
, options: {
toJSONValue: (value: T) => JSONValue
fromJSONValue: (json: JSONValue) => T

timeToLive: number
staleWhileRevalidate: number
}
)
}
```

### StaleIfErrorAsyncCacheService
```ts
class StaleIfErrorAsyncCacheService implements IStaleIfErrorAsyncCache {
constructor(
client: CacheClient
, namespace: string
, options: {
toJSONValue: (value: T) => JSONValue
fromJSONValue: (json: JSONValue) => T

timeToLive: number
staleIfError: number
}
)
}
```

### StaleWhileRevalidateAndStaleIfErrorAsyncCacheService
```ts
class StaleWhileRevalidateAndStaleIfErrorAsyncCacheService implements IStaleWhileRevalidateAndStaleIfErrorAsyncCache {
constructor(
client: CacheClient
, namespace: string
, options: {
toJSONValue: (value: T) => JSONValue
fromJSONValue: (json: JSONValue) => T

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