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
You iterate over a set of keys, you fetch each item, you transform it and map it to state
But what if you need the key for the item you just fetched? That's been passed to get by each but then been overwritten. If the key doesn't happen to be in data, you've lost it.
The workaround is to fetch it out of references like this:
One solution would be for all redis functions to return { key, data }, much like how http returns { response, data }. That would make the key associated with data available downstream.
If there's other metadata we might want to include, perhaps we need a meta or response to be added to state instead.
The text was updated successfully, but these errors were encountered:
In redis, a really common pattern is gonna be something like this
You iterate over a set of keys, you fetch each item, you transform it and map it to state
But what if you need the key for the item you just fetched? That's been passed to
get
byeach
but then been overwritten. If the key doesn't happen to be in data, you've lost it.The workaround is to fetch it out of references like this:
One solution would be for all redis functions to return
{ key, data }
, much like how http returns{ response, data }
. That would make the key associated with data available downstream.If there's other metadata we might want to include, perhaps we need a
meta
orresponse
to be added to state instead.The text was updated successfully, but these errors were encountered: