Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

License

Notifications You must be signed in to change notification settings

mccutchen/fillcache

Repository files navigation

fillcache

Documentation Build status Code coverage Go 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 package and 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

License

Stars

Watchers

Forks

AltStyle によって変換されたページ (->オリジナル) /