Esempio n. 1
0
 /// <summary>
 /// 检查缓存项是否达到过期时间。
 /// </summary>
 /// <returns>过期为 true,有效为 false。</returns>
 public bool HasExpired()
 {
     return(ExpirationTime.Kind switch
     {
         DateTimeKind.Utc => DateTime.UtcNow > ExpirationTime,
         DateTimeKind.Unspecified => DateTime.Now > ExpirationTime.ToLocalTime(),
         _ => DateTime.Now > ExpirationTime
     });