mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
How was this ever working for dev? In that case, `buildId = "development"` and so it always uses the same cache key
36 lines
959 B
JavaScript
36 lines
959 B
JavaScript
// @ts-check
|
|
|
|
const defaultCacheHandler =
|
|
require('next/dist/server/lib/cache-handlers/default.external').default
|
|
|
|
/**
|
|
* @type {import('next/dist/server/lib/cache-handlers/types').CacheHandler}
|
|
*/
|
|
const cacheHandler = {
|
|
async get(cacheKey, softTags) {
|
|
console.log('CustomCacheHandler::get', cacheKey, JSON.stringify([softTags]))
|
|
return defaultCacheHandler.get(cacheKey, softTags)
|
|
},
|
|
|
|
async set(cacheKey, pendingEntry) {
|
|
console.log('CustomCacheHandler::set', cacheKey)
|
|
return defaultCacheHandler.set(cacheKey, pendingEntry)
|
|
},
|
|
|
|
async refreshTags() {
|
|
return defaultCacheHandler.refreshTags()
|
|
},
|
|
|
|
async getExpiration(tags) {
|
|
// Expecting soft tags in `get` to be used by the cache handler for checking
|
|
// the expiration of a cache entry, instead of letting Next.js handle it.
|
|
return Infinity
|
|
},
|
|
|
|
async updateTags(tags) {
|
|
return defaultCacheHandler.updateTags(tags)
|
|
},
|
|
}
|
|
|
|
module.exports = cacheHandler
|