@ngx-ssr/cache
TypeScript icon, indicating that this package has built-in type declarations

1.2.1 • Public • Published

@ngx-ssr/cache

Install package

npm i @ngx-ssr/cache

Import the NgxSsrCacheModule module to cache all GET requests

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

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,
    })
  )
);

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.2.1281latest
1.2.0-beta.10beta

Version History

VersionDownloads (Last 7 Days)Published
1.2.1281
1.2.00
1.2.0-beta.10
1.1.127
1.1.00
1.0.10
1.0.00

Package Sidebar

Install

npm i @ngx-ssr/cache

Weekly Downloads

308

Version

1.2.1

License

none

Unpacked Size

152 kB

Total Files

38

Last publish

Collaborators

  • defenderbass