Skip to content

How to use FusionCache with prefetching? #69

Answered by jodydonetti
hvgNET asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @hvgNET and thanks for considering FusionCache.

Sorry for the delay in answering but covid finally got me.

In general your idea seems the right one to me:

  • load all 10.000.000 items from the db in one go
  • save them all in the cache individually with a Set call for each of them (with a reasonable cache duration)

Then, when you need one of them during the lifetime of your application, call GetOrSet({id}, _ => GetValue(id)) so that if the value is still in the cache you'll get it back immediately and, if not in the cache anymore, it will be loaded from the db and saved in the cache.

There's this passage that I don't understand though:

But that just seems... a bit hacky to me as i neither…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@hvgNET
Comment options

@jodydonetti
Comment options

Answer selected by hvgNET
Comment options

You must be logged in to vote
0 replies
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 #68 on July 10, 2022 12:58.