Download next.js/test/production/custom-server/cache-handler.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 852 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/production/custom-server/cache-handler.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/production/custom-server/cache-handler.js
-
curl -L -o cache-handler.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/production/custom-server/cache-handler.js
852 Bytes
| // @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').CacheHandlerV2} | |
| */ | |
| 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 expireTags(...tags) { | |
| return defaultCacheHandler.expireTags(...tags) | |
| }, | |
| } | |
| module.exports = cacheHandler | |