Skip to content

Easiest way to cache a resource's results? #1162

Answered by gbj
blumbra63 asked this question in Q&A
Discussion options

You must be logged in to vote

Why not just have a HashMap where the key is the month and the value is a resource of the data for that month? It doesn't even seem like it needs to be reactive, to me; just an Rc<RefCell<HashMap<_, _>>> or, for convenience, use store_value and have a StoredValue<HashMap<_, _>>? Whenever you switch months, you then use the map's entry API to either get the corresponding resource or create a new resource.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by blumbra63
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
None yet
2 participants