# @microphi/cache

> a typescript decorator to cache observables

Latest version **0.0.44** (published 2020-01-15) · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @microphi/cache
pnpm add @microphi/cache
yarn add @microphi/cache
bun add @microphi/cache
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.44 |
| Published | 2020-01-15 |
| First published | 2019-10-13 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 46.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | davidecavaliere |

## Links

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

## Dependencies (1)

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

## Recent versions

- 0.0.44 (latest) — 2020-01-15
- 0.0.3 — 2020-01-15
- 0.0.2 — 2020-01-15
- 0.0.1 — 2019-10-13

## README

# 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 

```bash
yarn add @microphi/cache
``` 

```bash
npm i @microphi/cache
```

## Usage

```typescript
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}`)
  }

}
```

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