An opinionated cache
To start using this library, run the following command in the Package Manager Console
PM> Install-Package opinionated-cache
This project adheres to the [Open Code of Conduct][code-of-conduct]. By participating, you are expected to honor this code. [code-of-conduct]: http://todogroup.org/opencodeofconduct/#Tacklr/abuse@tacklr.com
Release notes:
1.1.2 Fixing Cache Clear of prefixed keys
- When you do a Clear the key value was supposed to allow passing a prefix string that would clear all entries that start with that prefix. It does this by appending a period (the previous default KeySeparator) to the key given and clearing anything that starts with that prefix. Now that the KeySeparator is settable, we have to ask the IBaseCacheKey for the separator to append so that we get the correct value (currently a forward slash).
- This is a Breaking Change because I need to expose the PolicyRepository on the
IBaseCacheKeyinterface. If you are not using your own implementations ofIBaseCacheKeythat don't derive fromBaseCacheKey, you will have to provide that gettor.
1.1.1 Making it faster
- Made the Get method use
as Tinstead of a(T)cast so we don't throw when a cache key calls for the wrong kind of object in the cache (e.g. you stored a IFoo, but the cache key being passed is associated with an IBar) - The interal
Logmethod now passes the detail information as a delegate so we don't bother doing theToString()and concatenation unless theDebugLogflag is true. - The internal calls to
Logare nowConditionalon the DEBUG constant when building, so we don't even attempt to call the method unless you're building from source in DEBUG
1.1 Adding features
- Added
DoandDo<TRet>for backing methods that don't return elements that can be cached (voidorintreturns for example). - Breaking Change Added
IBaseCacheKey.BuildKeyandIBaseCacheKey.BuildPolicyKeyfor use by implementations of cache keys and exposed the standard behavior in ```BaseCacheKey`` so the standard way of doing things can easily be done. - Breaking Change Removed the N overloads of
BaseCacheKey.BuildKeyandBaseCacheKey.BuildPolicyKeyand added aparams string[]version so we can pass any number of strings to be joined. - Breaking Change
AddOrUpdatedoes not enroll the new element in the cache because we really don't have a good method of knowing the best backing method to refill. Rather, we now justClearthe cache entries.
1.0
- Initial release.