/rest-cache

This is an extension for LoopBack 4 to cache data. This extension uses the code base from alfonsocj

Primary LanguageTypeScript

rest-cache

LoopBack

Installation

Install RestCacheComponent using npm;

$ [npm install | yarn add] @aaqilniz/rest-cache

Basic Use

Configure and load RestCacheComponent in the application constructor as shown below.

import {RestCacheComponent, RestCacheComponentOptions, DEFAULT_REST_CACHE_OPTIONS} from 'rest-cache';
// ...
export class MyApplication extends BootMixin(ServiceMixin(RepositoryMixin(RestApplication))) {
  constructor(options: ApplicationConfig = {}) {
    const opts: RestCacheComponentOptions = DEFAULT_REST_CACHE_OPTIONS;
    this.configure(RestCacheComponentBindings.COMPONENT).to(opts);
      // Put the configuration options here
    });
    this.component(RestCacheComponent);
    // ...
  }
  // ...
}