Closed yflau closed 1 year ago
Hi @yflau,
Thank you for your proposal but I think in our case it will not fit well.
Indeed, as the package singleflight name suggests, it will make a “single” call and never call again unless the key is forgotten.
In our case we don’t know when the key is forgotten because it will be expired by the cache engine and so we will reload it into the cache. But we will always check for the key to exist in the cache engine.
I don’t see the benefits of using singleflight here but if you want to provide an implementation that proves me I am wrong please feel free to submit a pull request with that.
Thank you!
Closing for now but feel free to reopen.
With golang.org/x/sync/singleflight, it provides a duplicate function call suppression mechanism, maybe it's better for gocache Loadable to support this feature builtin.