diff --git a/xml/Microsoft.Extensions.Caching.Memory/CacheExtensions.xml b/xml/Microsoft.Extensions.Caching.Memory/CacheExtensions.xml index 3ece5dae235..c4ace7e8795 100644 --- a/xml/Microsoft.Extensions.Caching.Memory/CacheExtensions.xml +++ b/xml/Microsoft.Extensions.Caching.Memory/CacheExtensions.xml @@ -113,9 +113,9 @@ The instance this method extends. The key of the value to get. - Gets the value associated with this key if present. + Gets the value associated with this key if present and castable to . - The value associated with this key, or default(TItem) if the key is not present. + The value associated with this key, or default(TItem) if the key is not present or the stored value can't be cast to . To be added. @@ -595,13 +595,15 @@ The type of the object to get. The instance this method extends. The key of the value to get. - The value associated with the given key. + The value associated with the given key, or default(TItem) if the key is not found or the stored value can't be cast to . - Tries to get the value associated with the given key. + Tries to get the value associated with the given key and cast it to . - true if the key was found; false otherwise. - To be added. + true if the key was found and the stored value can be cast to ; false otherwise. + + This method returns false both when the key is not present in the cache and when the key is present but the stored value can't be cast to . If you need to distinguish between these two cases (for example, in instrumented caches tracking hit/miss metrics), use the non-generic method instead, which returns true if the key is present regardless of type. +