# @ngx-ssr/cache

> Install package

Latest version **1.2.1** (published 2023-05-07) · 188 weekly downloads

## Install

```sh
npm install @ngx-ssr/cache
pnpm add @ngx-ssr/cache
yarn add @ngx-ssr/cache
bun add @ngx-ssr/cache
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2023-05-07 |
| First published | 2021-01-12 |
| Weekly downloads | 188 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 148.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | defenderbass |
| Keywords | angular, angulae ssr, universal, angular/universal, ssr, cache, lru-cache, interceptor |

## Links

- npm: https://www.npmjs.com/package/@ngx-ssr/cache
- npm.io page: https://npm.io/package/@ngx-ssr/cache

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.0.0

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 1.2.1 (latest) — 2023-05-07
- 1.2.0-beta.1 (beta) — 2021-11-30
- 1.2.0 — 2023-05-07
- 1.1.1 — 2021-02-18
- 1.1.0 — 2021-02-10
- 1.0.1 — 2021-01-12
- 1.0.0 — 2021-01-12

## README

# @ngx-ssr/cache

Install package

```bash
npm i @ngx-ssr/cache
```

Import the `NgxSsrCacheModule` module to cache all GET requests

```ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { NgxSsrCacheModule } from '@ngx-ssr/cache';
import { environment } from '../environments/environment';

@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,
    NgxSsrCacheModule.configLruCache({ maxAge: 10 * 60_000, maxSize: 50 }),
  ],
  bootstrap: [AppComponent],
})
export class AppModule {
}
```

HTML caching is also available for express

```ts
import { ngExpressEngine } from '@nguniversal/express-engine';
import { LRUCache } from '@ngx-ssr/cache';
import { withCache } from '@ngx-ssr/cache/express';

server.engine(
  'html',
  withCache(
    new LRUCache({ maxAge: 10 * 60_000, maxSize: 100 }),
    ngExpressEngine({
      bootstrap: AppServerModule,
    })
  )
);
```

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