Files
vercel__next.js/test/production/custom-server/cache-handler.js
Niklas Mischkulnig 8330e4c4cd test: Improve test cache handler implementations (#98098)
- Some of them were not forwarding `getExpiration` or `softTags` to
`defaultCacheHandler`
- use-cache-cross-deployment was ignoring softTags and expiration. (This
patch was written by Sol)

---------

Co-authored-by: Hendrik Liebau <mail@hendrik-liebau.de>
2026-08-31 13:59:14 +02:00

36 lines
858 B
JavaScript

// @ts-check
const { requestIdStorage } = require('./als')
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) {
return defaultCacheHandler.get(cacheKey, softTags)
},
async set(cacheKey, pendingEntry) {
const requestId = requestIdStorage.getStore()
console.log('set cache', cacheKey, 'requestId:', requestId)
return defaultCacheHandler.set(cacheKey, pendingEntry)
},
async refreshTags() {
return defaultCacheHandler.refreshTags()
},
async getExpiration(tags) {
return defaultCacheHandler.getExpiration(tags)
},
async updateTags(tags) {
return defaultCacheHandler.updateTags(tags)
},
}
module.exports = cacheHandler