-
Notifications
You must be signed in to change notification settings - Fork 34
Cache Builders
Alex Peck edited this page Sep 18, 2022
·
12 revisions
Builders are provided for both ConcurrentLru and ConcurrentLfu to make it easy to configure cache options.
For example, this is how to create a ConcurrentLru
with scoped values, and GetOrAdd
that is both async and has atomic value creation:
IScopedAsyncCache<int, Disposable> lru = new ConcurrentLruBuilder<int, Disposable>()
.WithAtomicGetOrAdd()
.AsScopedCache()
.AsAsyncCache()
.WithCapacity(3)
.Build();