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
I used gocache from github.com/patrickmn/go-cache and created a store. I then created a new loadable from that store with a LoadFunction to fetch the value if it's not in the cache already. The function seems to work fine but upon retrieval of the data element, it is not automatically stored in the store. Here is a small snippet for further investigation:
The values returned from the loadFunc are sent to the setChannel instead of being directly set in the cache. The values in setChannel are iterated over in a separate goroutine and then set to the cache.
// Unable to find in cache, try to load it from load functionobject, err=c.loadFunc(key)
iferr!=nil {
returnobject, err
}
// Then, put it back in cachec.setChannel<-&loadableKeyValue{key, object}
Therefore, you need to wait a bit before calling the second Get operation.
I used gocache from github.com/patrickmn/go-cache and created a store. I then created a new loadable from that store with a LoadFunction to fetch the value if it's not in the cache already. The function seems to work fine but upon retrieval of the data element, it is not automatically stored in the store. Here is a small snippet for further investigation:
Steps for Reproduction
Expected behavior:
Expected output would only have a single log
Actual behavior:
Multiple logs indicating that fetched value isn't saved
Platforms:
uname -a:
Linux 6.8.0-36-generic #36-Ubuntu SMP PREEMPT_DYNAMIC Mon Jun 10 10:49:14 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Include browser, operating system and respective versions
Versions:
The text was updated successfully, but these errors were encountered: