Skip to content

Repository files navigation

fillcache

DocumentationBuild statusCode coverageGo report card

An in-process cache with single-flight filling semantics.

In short: Given a function that computes the value to be cached for a key, it will ensure that the function is called only once per key no matter how many concurrent cache gets are issued for a key.

This might be useful if, say, you find yourself reaching for the singleflight packageand you want to cache the resulting values in memory.

Usage

See example_test.go for example usage.

Testing

make test

Credits

If you like this package, all credit should go to @jphines, who suggested the initial design as we were working through an in-process DNS caching mechanism.

If you don't like its design or its implementation, all blame lies with @mccutchen.

About

A simple in-process cache with single-flight filling semantics

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages