Skip to content
Discussion options

You must be logged in to vote

Hey @BredyOST! I understood the problem. You did this in your component, but you don't need to do this:

const cacheResult = await IncrementalCache.set('prices', prices)

When building your Next.js app, the IncrementalCache class becomes part of the Next.js server. The IncrementalCache class must only be used in the Cache-handler.js file and not in any components.

Let me explain how caching works.

const pricesRes = await fetch('http://localhost:7777/prices/getAll', { next: { revalidate: 86400 }})

Upon the initial return of this fetch call, the result will be automatically cached in your Redis server using the strategy from the Cache-handler.js file. The next time, instead of making a new fe…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by BredyOST
Comment options

You must be logged in to vote
4 replies
@better-salmon
Comment options

@BredyOST
Comment options

@BredyOST
Comment options

@better-salmon
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants
Converted from issue

This discussion was converted from issue #207 on December 10, 2023 22:40.