Skip to content

Latest commit

 

History

History
43 lines (32 loc) · 1.2 KB

README.md

File metadata and controls

43 lines (32 loc) · 1.2 KB

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