1.0.2 • Published 4 years ago
js-api-cache v1.0.2
js-api-cache
improve experience by caching api returns
Installation:
npm i js-api-cache
Usage:
import { cache, clearCache, setDebug } from 'js-api-cache'
setDebug(true)
//CRUD api cache samples for Xxxx object
@cache({ maxAge: 300000, cacheName: 'Xxxx' })
async listXxxx() {
... // fectch url
return xArray
}
@cache({ maxAge: 300000, cacheName: 'Xxxx' })
async getXxxx() {
...
return xObject
}
@cache({ maxAge: 300000, cacheName: 'Xxxx' })
async addXxxx() {
...
return xObjectOrId
}
@cache({ maxAge: 300000, cacheName: 'Xxxx' })
async updateXxxx() {
...
return xObjectOrId
}
@cache({ maxAge: 300000, cacheName: 'Xxxx' })
async deteleXxxx() {
...
}