-
Notifications
You must be signed in to change notification settings - Fork 165
Allow null values to be cached and refine TryGet method (see #155) #157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Allow null values to be cached and refine TryGet method (see #155) #157
Conversation
removed the null check for the item parameter in the CachingService.Add method
|
Using the IAppCache.TryGetValueAsync method is quite convoluted. Consider this example: The API used must I'm not a big fan of output parameters, because they are basically parameters used to return values outside of a method. Some people consider them as a bad practice. We can maybe consider to refactor the signature of both By doing so, we can write an |
|
Hi, any news on this ? Did you take a canche to review ? |
I have introduced the following changes:
IAppCache.Addmethod allows to cachenullvalues. No exception is thrown.IAppCache.TryGetValuefrombool TryGetValue<T>(string key, out object value);tobool TryGetValue<T>(string key, out T value);IAppCache.TryGetValueso that values cached by usingIAppCache.GetOrAddand / orIAppCache.GetOrAddAsyncare handled correctly (the actual cached value is returned insted of the lazy wrapper).bool TryGetValueAsync<T>(string key, out Task<T> value);used to try fetch values cached by usingIAppCache.GetOrAddAsyncSee issue #155 for the details.