private void UpdateIndex(string partionKey, string key) { var index = InnerCache.GetOrCreate(partionKey, entry => new HashSet <string>()); index.Add(key); InnerCache.Set(partionKey, index, CacheDuration); }
public CacheMethodTaken SetScoped <TValue>(String key, TValue value, DateTimeOffset valueTimestamp) { var directives = CacheDirectives.CurrentScope; if (directives.Method.HasFlag(CacheMethod.Set)) { InnerCache.Set(key, new ScopedValue <TValue>(value, valueTimestamp), GetRuntimePolicy(), regionName: null); return(CacheMethodTaken.Set); } return(CacheMethodTaken.None); }
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.Set(key, val, GetRuntimePolicy(), null); }
public void Set(TKey key, TValue value, TimeSpan?slidingExpireTime = default(TimeSpan?)) { InnerCache.Set(key.ToString(), value, slidingExpireTime); }