This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

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

0.0.44 • Public • Published

Cache

A @Cache decorator for Angular. To be used to annotate a method that return an observable (i.e.: HttpClient's methods). It will cache the returned observable for a ttl in milliseconds timespan. If ttl is not specified the cache will be valid forever until the annotated method is called with different arguments.

install

yarn add @microphi/cache
npm i @microphi/cache

Usage

import { Cache } from '@microphi/cache';

@Injectable()
export class UserService {

  constructor(private _client: HttpClient) {}

  @Cache({
    ttl: 2500
  })
  public findAll(id): Observable<any> {
    return this._client.get(`https://reqres.in/api/users?page=${id}`)
  }

}

Readme

Keywords

none

Package Sidebar

Install

npm i @microphi/cache

Weekly Downloads

0

Version

0.0.44

License

none

Unpacked Size

47.4 kB

Total Files

20

Last publish

Collaborators

  • davidecavaliere