decorator-cache-getter
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Decorator Cache Getter

NPM version NPM downloads Build status Test coverage

Simple decorator for caching getters on first access.

Installation

npm install decorator-cache-getter --save

Usage

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

Install

npm i decorator-cache-getter

DownloadsWeekly Downloads

688

Version

1.0.0

License

MIT

Unpacked Size

11.5 kB

Total Files

9

Last publish

Collaborators

  • blakeembrey