Closed brantburnett closed 2 years ago
Previous changes to handle DocumentNotFoundException when getting from the cache missed the static extension methods.
Handle the DocumentNotFoundException in the static extension methods, returning default/null on a cache miss.
Add nullable annotations indicating the potential null return value, which required moving up to C# 9.
Strongly-typed gets from the cache now return null instead of throwing an exception, correctly matching the interface spec for IDistributedCache.
Motivation
Previous changes to handle DocumentNotFoundException when getting from the cache missed the static extension methods.
Modifications
Handle the DocumentNotFoundException in the static extension methods, returning default/null on a cache miss.
Add nullable annotations indicating the potential null return value, which required moving up to C# 9.
Results
Strongly-typed gets from the cache now return null instead of throwing an exception, correctly matching the interface spec for IDistributedCache.