teleman-cache
v0.1.0-5
Published
Teleman Server-Side Rendering middleware
Downloads
4
Maintainers
Readme
teleman-cache
Teleman Server-Side Rendering middleware
Usage
import Teleman from 'teleman'
import cache from 'teleman-cache'
const api = new Teleman({
urlPrefix: 'https://api.example.com'
})
api.use(cache({
mode: CURRENT_ENV, // server | client
variable: '__API_CACHE__',
cacheKeyGenerator(ctx) {
return ctx.url.pathname + ctx.url.search
},
tagGenerator(ctx) {
return ctx.cacheTag
},
onServerCached() {
window.PAGE_READY = true
},
onClientConsumed() {
mountAPPIntoDOM()
}
}))