public void Set(string cacheKey, object value) { lock (CacheLock) { InnerCache.Add(cacheKey, value); } }
public void Add(string cacheKey, TimeSpan slidingExpiryWindow, object dataToAdd) { if (dataToAdd == null || !IsCacheEnabled) { return; } InnerCache.Add(cacheKey, slidingExpiryWindow, dataToAdd); }
public void Add(string cacheKey, DateTime absoluteExpiryDate, object dataToAdd) { if (dataToAdd == null || !IsCacheEnabled) { return; } InnerCache.Add(cacheKey, absoluteExpiryDate, dataToAdd); }
public virtual void Add(string ip, WhoIsInformation value) { Assert.ArgumentNotNull(ip, "ip"); Assert.ArgumentNotNull(value, "value"); if (!Enabled) { return; } InnerCache.Add(ip, value, Settings.GeoIpCacheExpiryTime); }
//AddSite public void AddSite(Site siteItem) { if (ContainsSite(siteItem)) { RemoveSite(siteItem); } var cacheItem = new SiteCacheItem(siteItem); InnerCache.Add(siteItem.Name, cacheItem); }
/// <summary> /// Adds or updates the specified key/value pair. /// </summary> /// <param name="key">The key.</param> /// <param name="value">The value.</param> /// <returns> /// True if the specified key/value pair was added; /// False if the specified key/value pair was updated. /// </returns> public bool Add(TKey key, TValue value) { bool added = InnerCache.Add(key, value); if (added) { IncrementCount(); MetricReporter.NotifySizeChange(Name); } return(added); }
protected override void Add <TValue>(string key, TValue value) { var val = Newtonsoft.Json.JsonConvert.SerializeObject( value, Newtonsoft.Json.Formatting.None, new Newtonsoft.Json.JsonSerializerSettings { TypeNameHandling = Newtonsoft.Json.TypeNameHandling.All, Culture = System.Globalization.CultureInfo.InvariantCulture, }); InnerCache.Add(key, val, GetRuntimePolicy(), null); }
/// <summary> /// Adds or updates the specified key/value pair. /// </summary> /// <param name="key">The key.</param> /// <param name="value">The value.</param> /// <returns> /// True if the specified key/value pair was added; /// False if the specified key/value pair was updated. /// </returns> public bool Add(TKey key, TValue value) { bool added = true; RedisKey redisKey = GetRedisKey(key); _memoryStore.StringSet(redisKey, GetRedisValue(key, value), KeyExpiry); if (InnerCache != null) { added = InnerCache.Add(key, value); } return(added); }
public void SetObject(string key, object value, long size, int lifespan) { if (value == null || InnerCache.MaxSize == 0) { return; } try { if (lifespan > 0) { InnerCache.Add(key, value, size, TimeSpan.FromSeconds(lifespan)); } else { InnerCache.Add(key, value, size); } } catch (Exception ex) { Log.Error("Failed to set a cache object", ex, "SharedSource.RedirectModule.Caching"); } }
/// <summary> /// Add new data to the cache /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> /// <param name="value"></param> public void AddData <T>(object key, object value) { InnerCache.Add(key, value, GetObjectCacheSize(value), CacheDuration); }
/// <summary> /// Adds or updates the specified key/value pair. /// </summary> /// <param name="key">The key.</param> /// <param name="value">The value.</param> /// <returns> /// True if the specified key/value pair was added; /// False if the specified key/value pair was updated. /// </returns> public bool Add(TKey key, TValue value) { return(InnerCache.Add(key, value)); }
public void SetRules <T>(IEnumerable <T> outboundRules, string key) where T : IBaseRule { InnerCache.Add(key, outboundRules); }