You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FileCache should provide a AddOrGetExisting method which takes a factory #56
Currently the AddOrGetExisting method takes a value, which requires you to pre-compute the value whether or not the entry is already in the cache. Instead it should take a generator method (Func<T>) which will generate the value in the instance of a cache miss. See https://github.com/alastairtree/LazyCache for an example of this, copied here:
// Declare (but don't execute) a func/delegate whose result we want to cacheFunc<ComplexObjects>complexObjectFactory=()=>methodThatTakesTimeOrResources();// Get our ComplexObjects from the cache, or build them in the factory func // and cache the results for next time under the given keyComplexObjectscachedResults=cache.GetOrAdd("uniqueKey",complexObjectFactory);
It should also provide an async overload for this operation as well
Activity