|
PeanutButter
|
SingleItemCache provides a light, fast, caching wrapper around a function to generate a value with a provided TTL. More...
Public Member Functions | |
| 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. | |
Properties | |
| 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. | |
Properties inherited from PeanutButter.Utils.ISingleItemCache< T > | |
SingleItemCache provides a light, fast, caching wrapper around a function to generate a value with a provided TTL.
| 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.
| generator | |
| timeToLive |
| NotImplementedException |
| 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.
| generator | |
| cacheInvalidator |
| void PeanutButter.Utils.SingleItemCache< T >.Invalidate | ( | ) |
Invalidates the cache such that the next call will definitely regenerate the value.
| NotImplementedException |
Implements PeanutButter.Utils.ISingleItemCache< T >.
|
get |
Expose the generator (might be useful for testing purposes)
Implements PeanutButter.Utils.ISingleItemCache< T >.
|
get |
Expose the provided TimeToLive (might be useful for testing purposes)
Implements PeanutButter.Utils.ISingleItemCache< T >.
|
get |
The value for the generator, or a cached value, if available and still fresh enough.
Implements PeanutButter.Utils.ISingleItemCache< T >.