Default Result in Umbraco.Core.Cache.CacheProviderExtensions
Not sure if this is the right place, but I would like to recommend removing the default result from the cache provider extension:
public static T GetCacheItem<T>(this ICacheProvider provider, string cacheKey) { var result = provider.GetCacheItem(cacheKey); if (result == null) { return default(T); } return result.TryConvertTo<T>().Result; }
Notice how the cache will return a default if the get does not return a result. This can create unknown results on behalf of consumers of this service. They may think they have gotten the correct object, but in fact have gotten a default value. The consume should make a decision what to do in the event of a null result. The fix here is to change return default(T) to return null.
Default Result in Umbraco.Core.Cache.CacheProviderExtensions
Not sure if this is the right place, but I would like to recommend removing the default result from the cache provider extension:
Notice how the cache will return a default if the get does not return a result. This can create unknown results on behalf of consumers of this service. They may think they have gotten the correct object, but in fact have gotten a default value. The consume should make a decision what to do in the event of a null result. The fix here is to change return default(T) to return null.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.