SingleItemCache provides a light, fast, caching wrapper around a function to generate a value with a provided TTL.
More...
|
| SingleItemCache (Func< T > generator, TimeSpan timeToLive) |
| SingleItemCache provides a light, fast, caching wrapper around a function to generate a value with a provided TTL.
|
| SingleItemCache (Func< T > generator, Func< bool > cacheInvalidator) |
| SingleItemCache provides a light, fast, caching wrapper around a function to generate a value with a provided function to test if the cache should be invalidated before the each read.
|
void | Invalidate () |
| Invalidates the cache such that the next call will definitely regenerate the value.
|
|
T | Value [get] |
| The value for the generator, or a cached value, if available and still fresh enough.
|
Func< T > | Generator [get] |
| Expose the generator (might be useful for testing purposes)
|
TimeSpan | TimeToLive [get] |
| Expose the provided TimeToLive (might be useful for testing purposes)
|
Func< bool > | CacheInvalidator [get] |
| When provided via the alternative constructor.
|
SingleItemCache provides a light, fast, caching wrapper around a function to generate a value with a provided TTL.
◆ Invalidate()
void PeanutButter.Utils.SingleItemCache< T >.Invalidate |
( |
| ) |
|
◆ SingleItemCache() [1/2]
PeanutButter.Utils.SingleItemCache< T >.SingleItemCache |
( |
Func< T > | generator, |
|
|
Func< bool > | cacheInvalidator ) |
SingleItemCache provides a light, fast, caching wrapper around a function to generate a value with a provided function to test if the cache should be invalidated before the each read.
- Parameters
-
generator | |
cacheInvalidator | |
◆ SingleItemCache() [2/2]
PeanutButter.Utils.SingleItemCache< T >.SingleItemCache |
( |
Func< T > | generator, |
|
|
TimeSpan | timeToLive ) |
SingleItemCache provides a light, fast, caching wrapper around a function to generate a value with a provided TTL.
- Parameters
-
- Exceptions
-
◆ Generator
Func<T> PeanutButter.Utils.SingleItemCache< T >.Generator |
|
get |
◆ TimeToLive
TimeSpan PeanutButter.Utils.SingleItemCache< T >.TimeToLive |
|
get |
◆ Value
T PeanutButter.Utils.SingleItemCache< T >.Value |
|
get |
The documentation for this class was generated from the following file:
- source/Utils/PeanutButter.Utils/SingleItemCache.cs