You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// This example uses composite handler to switch from Redis to LRU cache if tags contains `memory-cache` tag.
223
+
// You can skip composite and use Redis or LRU only.
224
+
global.cacheHandlerConfig= {
225
+
handlers: [
226
+
createCompositeHandler({
227
+
handlers: [
228
+
lruCache,
229
+
createBufferStringHandler(redisCacheHandler), // Use `createBufferStringHandler` in Next15 and ignore it in Next14 or below
230
+
],
231
+
setStrategy: (ctx) => (ctx?.tags.includes("memory-cache") ?0:1), // You can adjust strategy for deciding which cache should the composite use
232
+
}),
233
+
],
234
+
};
235
+
236
+
returnglobal.cacheHandlerConfig;
237
+
})();
238
+
239
+
returnglobal.cacheHandlerConfigPromise;
240
+
});
241
+
242
+
module.exports=newNext15CacheHandler();
243
+
```
244
+
111
245
## Reference to Original Package
112
246
113
247
This package builds upon the core functionality provided by [`@neshca/cache-handler`](https://www.npmjs.com/package/@neshca/cache-handler). You can find more information about the core library, including usage examples and API documentation, at the [official documentation page](https://caching-tools.github.io/next-shared-cache).
0 commit comments