# decorator-cache-getter

> Simple decorator for caching getters on first access

Latest version **1.0.0** (published 2019-01-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install decorator-cache-getter
pnpm add decorator-cache-getter
yarn add decorator-cache-getter
bun add decorator-cache-getter
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-01-21 |
| First published | 2019-01-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Author | Blake Embrey |
| Maintainers | blakeembrey |
| Keywords | decorator, cache, lazy, getter, memoize, memo, es7 |

## Links

- npm: https://www.npmjs.com/package/decorator-cache-getter
- Repository: https://github.com/blakeembrey/decorator-cache-getter
- Issues: https://github.com/blakeembrey/decorator-cache-getter/issues
- npm.io page: https://npm.io/package/decorator-cache-getter

## 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.0.0 (latest) — 2019-01-21

## README

# Decorator Cache Getter

[![NPM version][npm-image]][npm-url]
[![NPM downloads][downloads-image]][downloads-url]
[![Build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]

> Simple decorator for caching getters on first access.

## Installation

```sh
npm install decorator-cache-getter --save
```

## Usage

```js
import { cache } from "decorator-cache-getter";

class User {
  @cache
  get friends() {
    return sql("SELECT * FROM users WHERE ...")
  }
}

const user = new User()
const friends = await user.friends;
```

## License

MIT

[npm-image]: https://img.shields.io/npm/v/decorator-cache-getter.svg?style=flat
[npm-url]: https://npmjs.org/package/decorator-cache-getter
[downloads-image]: https://img.shields.io/npm/dm/decorator-cache-getter.svg?style=flat
[downloads-url]: https://npmjs.org/package/decorator-cache-getter
[travis-image]: https://img.shields.io/travis/blakeembrey/decorator-cache-getter.svg?style=flat
[travis-url]: https://travis-ci.org/blakeembrey/decorator-cache-getter
[coveralls-image]: https://img.shields.io/coveralls/blakeembrey/decorator-cache-getter.svg?style=flat
[coveralls-url]: https://coveralls.io/r/blakeembrey/decorator-cache-getter?branch=master

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