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
🌿
- Host: GitHub
- URL: https://github.com/extra-memoize/blackglory-cache-service
- Owner: extra-memoize
- License: mit
- Created: 2022-04-14T10:51:18.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2025-08-12T10:31:20.000Z (11 months ago)
- Last Synced: 2025-10-11T10:57:53.453Z (9 months ago)
- Topics: browser, esm, library, nodejs, npm-package, typescript
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@extra-memoize/blackglory-cache-service
- Size: 1.62 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
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
}
)
}
```