How to add a cache hit marker? For example, add a response header X-cache-status: HIT.
How to add a cache hit marker? For example, add a response header X-cache-status: HIT.
Currently that's not directly possible to do yourself, but this could easily be added as a feature to the module when returning a route from cache. Would probably also make sense to add additional headers for debugging purposes, such as time cached and expiration.
Currently that's not directly possible to do yourself, but this could easily be added as a feature to the module when returning a route from cache. Would probably also make sense to add additional headers for debugging purposes, such as time cached and expiration.
import { defineMultiCacheOptions } from 'nuxt-multi-cache/server-options'
export default defineMultiCacheOptions(() => {
return {
route: {
alterCachedHeaders(headers) {
// Add a response header mark
headers['X-cache-status'] = 'HIT'
return headers
},
},
}
})
For cases that have been cached, this is ok.