-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cache: implement single-flight caching in the inmemory cache
Implement a single-flight mode for the inmemory cache. Since our code goes and does something when Fetch() misses, let's implement the single-flight mode based on this assumption - wait for the results of the previous request and use it. https://pkg.go.dev/golang.org/x/sync/singleflight is not used to avoid complexity - there is no single function that we can call to get results of some operation. Potentially it could be wrapped around the `Bucket` interface but then the caching/remote object storage interfaces would be muddled together and I really think we should avoid that. Tested on a cluster and with unit tests. Signed-off-by: Giedrius Statkevičius <[email protected]>
- Loading branch information
Showing
3 changed files
with
190 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters