Background and motivation
Right now, wenn calling this overload, an actual value must be passed. It would be nice to allow nullable values here, since the target-property actually is.
API Proposal
public static TItem Set<TItem>(this IMemoryCache cache, object key, TItem value, DateTimeOffset? absoluteExpiration)
{
using ICacheEntry entry = cache.CreateEntry(key);
entry.AbsoluteExpiration = absoluteExpiration;
entry.Value = value;
return value;
}
API Usage
cache.Set(key, value, options?.absoluteExpirationRelativeToNow);
Alternative Designs
No response
Risks
No response