public bool Exists(string key) { if (!System.IO.File.Exists(GetFullPath(key, false))) { System.Threading.Thread.Sleep(200); if (!System.IO.File.Exists(GetFullPath(key, false))) { Logger.Debug($"Exist func: no {GetFullPath(key, false)}"); return(false); } } if (!System.IO.File.Exists(GetFullPath(key, true))) { Logger.Debug($"Exist func: no {GetFullPath(key, true)}"); return(false); } try { ExpirationData expireData = Deserialize <ExpirationData>(System.IO.File.ReadAllBytes(GetFullPath(key, false))); if (expireData == default(ExpirationData)) { Logger.Debug($"Exist func: no expiration data: " + Newtonsoft.Json.JsonConvert.SerializeObject(expireData)); return(false); } if (expireData.ExpirationInTicks == ExpirationData.UnlimitedExpiration.Ticks) { return(true); } bool stillValid = expireData.ExpiresAt() > DateTime.UtcNow; if (!stillValid) { Logger.Debug($"Exist func: expired data: " + Newtonsoft.Json.JsonConvert.SerializeObject(expireData)); return(false); } if (expireData.Created() != internalValueCreated) { internalValue = default(T); } return(stillValid); } catch (Exception e) { Logger.Debug("V20.FillCacheProvider Exists error for key " + key, e); //Remove(key); return(false); } }