Ejemplo n.º 1
0
 public bool Expired()
 {
     if (DurationUnit == CacheDurationUnit.Seconds)
     {
         return(AddedTime.AddSeconds(Duration) > DateTime.Now);
     }
     else if (DurationUnit == CacheDurationUnit.Minutes)
     {
         return(AddedTime.AddMinutes(Duration) > DateTime.Now);
     }
     else
     {
         return(AddedTime.AddHours(Duration) > DateTime.Now);
     }
 }
Ejemplo n.º 2
0
        public bool Expired()
        {
            DateTime cacheDuration;

            if (DurationUnit == CacheDurationUnit.Seconds)
            {
                cacheDuration = AddedTime.AddSeconds(Duration);
            }
            else if (DurationUnit == CacheDurationUnit.Minutes)
            {
                cacheDuration = AddedTime.AddMinutes(Duration);
            }
            else
            {
                cacheDuration = AddedTime.AddHours(Duration);
            }

            int expired = DateTime.Compare(DateTime.Now, cacheDuration);

            return(expired > 0);
        }