eko / gocache

☔️ A complete Go cache library that brings you multiple ways of managing your caches
https://vincent.composieux.fr/article/i-wrote-gocache-a-complete-and-extensible-go-cache-library/
MIT License
2.4k stars 193 forks source link

avoid parallel running a load function for the same key #242 #243

Closed advoretsky closed 4 months ago

advoretsky commented 4 months ago

used https://pkg.go.dev/golang.org/x/sync/singleflight to avoid parallel running of the loading function. modified test to check the new behavior

shotmk commented 4 months ago

Very anticipated improvement. Please review.