1.0.0 • Published 5 years ago

decorator-cache-getter v1.0.0

Weekly downloads
466
License
MIT
Repository
github
Last release
5 years ago

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