/
githubmirror
/
next.js
Обзор
Документация
Войти
/
githubmirror
/
next.js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
canary
test/production/custom-server/cache-handler.js
35 строк
838 B
JJ Kasper
Add new updateTag API and new signature for revalidateTag (#83822)
10 окт 2025, 00:03
Не верифицирован
10 окт 2025, 00:03
e598a4f
Код
Авторство
О чём код?
// @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) { return defaultCacheHandler.get(cacheKey) }, 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