mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
8330e4c4cd
- 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>
36 lines
858 B
JavaScript
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
|