decorator-cache-getter
v1.0.0
Published
Simple decorator for caching getters on first access
Downloads
7,527
Maintainers
Readme
Decorator Cache Getter
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