tronicache
1.0.3 • Public • Published Tronicache
An argument-aware opinionated memcache
Installation
npm install --save tronicache
Usage
Create a cached service
Indefinite caching by default
const { cached } = require('tronicache');
const service = cached({
getUser(uid) {
}
})
Configurable timeout
const { cached } = require('tronicache');
const service = cached({
timeout: 2 * 60 * 6000,
getUser(uid) {
}
})
Nested namespace support
const { cached } = require('tronicache');
const service = cached({
users: {
getUser(uid) {
},
posts: {
timeout: 2 * 60 * 1000,
postsOfUser(uid) {
const user = this.users.getUser(uid);
}
}
},
notifications: {
cache: false,
fetch() {
},
archive: {
cache: true,
fetch() { }
}
}
});
Package Sidebar
Install
Weekly Downloads