1.0.2 • Published 4 years ago

js-api-cache v1.0.2

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

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() {
	...
} 
1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago