# @extra-memoize/blackglory-cache-service

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

Latest version **0.8.2** (published 2026-02-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @extra-memoize/blackglory-cache-service
pnpm add @extra-memoize/blackglory-cache-service
yarn add @extra-memoize/blackglory-cache-service
bun add @extra-memoize/blackglory-cache-service
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.8.2 |
| Published | 2026-02-12 |
| First published | 2022-04-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=22 |
| Dependencies | 1 |
| Unpacked size | 24.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | BlackGlory |
| Maintainers | black_glory |

## Links

- npm: https://www.npmjs.com/package/@extra-memoize/blackglory-cache-service
- Repository: https://github.com/extra-memoize/blackglory-cache-service
- Homepage: https://github.com/extra-memoize/blackglory-cache-service#readme
- Issues: https://github.com/extra-memoize/blackglory-cache-service/issues
- npm.io page: https://npm.io/package/@extra-memoize/blackglory-cache-service

## Dependencies (1)

- [@blackglory/prelude](https://npm.io/package/@blackglory/prelude.md) ^0.4.0

## Recent versions

- 0.8.2 (latest) — 2026-02-12
- 0.8.1 — 2025-07-05
- 0.8.0 — 2025-07-04
- 0.7.3 — 2025-05-25
- 0.5.4 — 2024-02-25
- 0.7.2 — 2024-02-25
- 0.7.1 — 2023-06-10
- 0.7.0 — 2023-03-05
- 0.6.0 — 2023-03-05
- 0.5.3 — 2022-12-12
- 0.5.2 — 2022-09-09
- 0.5.1 — 2022-08-04
- 0.5.0 — 2022-07-28
- 0.4.1 — 2022-06-26
- 0.4.0 — 2022-06-01
- … 3 more at https://npm.io/package/@extra-memoize/blackglory-cache-service/versions

## 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<T> implements IAsyncCache<T> {
  constructor(
    client: CacheClient
  , namespace: string
  , options: {
      toJSONValue: (value: T) => JSONValue
      fromJSONValue: (json: JSONValue) => T

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

### StaleWhileRevalidateAsyncCacheService
```ts
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
```ts
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
```ts
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
    }
  )
}
```

---
_Source: https://npm.io/package/@extra-memoize/blackglory-cache-service · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
