Below code throwing argument null exception for token.ExpiresOn
since token is not in cache and null
. Is there way to check both in IF
clause - token not in cache plus token expires less than utc now?
if (!_cache.TryGetValue("KEY", out TokenClass token) && token.ExpiresOn < DateTimeOffset.UtcNow)
{
}