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/[email protected]
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
IBaseCacheKey
interface. If you are not using your own implementations ofIBaseCacheKey
that don't derive fromBaseCacheKey
, you will have to provide that gettor.
1.1.1 Making it faster
- Made the Get method use
as T
instead 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
Log
method now passes the detail information as a delegate so we don't bother doing theToString()
and concatenation unless theDebugLog
flag is true. - The internal calls to
Log
are nowConditional
on 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
Do
andDo<TRet>
for backing methods that don't return elements that can be cached (void
orint
returns for example). - Breaking Change Added
IBaseCacheKey.BuildKey
andIBaseCacheKey.BuildPolicyKey
for 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.BuildKey
andBaseCacheKey.BuildPolicyKey
and added aparams string[]
version so we can pass any number of strings to be joined. - Breaking Change
AddOrUpdate
does 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 justClear
the cache entries.
1.0
- Initial release.