cached_value library

A simple way to cache values that result from rather expensive operations.

Classes

CachedValue<CacheContentType>
A value container that caches values resultant from a potentially expensive operation.
DependentCachedValue<CacheContentType, DependencyType>
A CachedValue that its validity is defined by a dependency. It holds the last result of the computation callback since the last change on the result of the dependency callback.
SimpleCachedValue<CacheContentType>
A CachedValue that holds the last result of the computation callback since the start of the last time the cache was refresh via refresh.
SingleChildCachedValue<CacheContentType>
A type of CachedValue that contains another.
TimeToLiveCachedValue<CacheContentType>
A CachedValue that is invalidated some time after a refresh.

Extensions

DependentExtension on CachedValue<CacheContentType>
Adds withDependency to CachedValue.
TimeToLiveExtension on CachedValue<CacheContentType>
Adds withTimeToLive to CachedValue.

Typedefs

ComputeCacheCallback<CacheContentType> = CacheContentType Function()
A signature for functions that computes the value to be cached.
ComputeCacheDependency<DependencyType> = DependencyType Function()
A signature for functions that provides dependency of a DependentCachedValue.