next.js
d58f7aa0 - Use cacheMaxMemorySize config in default cache handler (#85153)

Commit
267 days ago
Use cacheMaxMemorySize config in default cache handler (#85153) ### What? This refactoring enables the `cacheMaxMemorySize` configuration option to control the memory limits of the default "use cache" handler. ### Why? Previously, the default cache handler was hardcoded to use 50MB of memory, ignoring the user's `cacheMaxMemorySize` configuration. This meant users couldn't: - Disable internal caching when using external CDNs (by setting size to 0) - Customize memory limits based on their deployment environment - Control memory usage for the "use cache" handler ### How? - Extracted cache handler creation into `createDefaultCacheHandler()` factory function - Threaded `cacheMaxMemorySize` through `initializeCacheHandlers()` calls - Harmonized parameter naming (`maxMemoryCacheSize` → `cacheMaxMemorySize`) for consistency with the config - Made `cacheMaxMemorySize` required in type signatures - Added zero-size optimization (returns no-op handler when size=0)
Author
Parents
Loading