public void Remove(CacheDataKeys key, object[] prms) { lock (Cache) { Cache.Remove(key.ToString() + GetKeyByParams(prms)); } }
public void Update(CacheDataKeys key, object data, object[] prms) { if (!Contains(key, prms)) { return; } lock (Cache) { Cache[key.ToString() + GetKeyByParams(prms)] = data; } }
public void SetUpdate(CacheDataKeys key, object data, int cacheTime, object[] prms) { if (!Contains(key, prms)) { Set(key, data, cacheTime, prms); } else { lock (Cache) { Cache[key.ToString() + GetKeyByParams(prms)] = data; } } }
public void Set(CacheDataKeys key, object data, int cacheTime, object[] prms) { if (Contains(key, prms)) { Remove(key, prms); } CacheItemPolicy policy = new CacheItemPolicy(); DateTime dt = DateTime.Now; policy.AbsoluteExpiration = dt + TimeSpan.FromSeconds(cacheTime); lock (Cache) { Cache.Add(new CacheItem(key.ToString() + GetKeyByParams(prms), data), policy); } }
public object Get(CacheDataKeys key, object[] prms) { return(Cache.Get(key.ToString() + GetKeyByParams(prms))); }
public bool Contains(CacheDataKeys key, object[] prms) { return(Cache.Contains(key.ToString() + GetKeyByParams(prms))); }
public object Get(CacheDataKeys key, object[] prms) { return Cache.Get(key.ToString() + GetKeyByParams(prms)); }
public bool Contains(CacheDataKeys key, object[] prms) { return Cache.Contains(key.ToString()+GetKeyByParams(prms)); }
public void SetUpdate(CacheDataKeys key, object data, int cacheTime, object[] prms) { if (!Contains(key, prms)) Set(key, data, cacheTime, prms); else lock (Cache) { Cache[key.ToString() + GetKeyByParams(prms)] = data; } }
public void Update(CacheDataKeys key, object data, object[] prms) { if (!Contains(key, prms)) return; lock (Cache) { Cache[key.ToString() + GetKeyByParams(prms)] = data; } }
public void Set(CacheDataKeys key, object data, int cacheTime, object[] prms) { if (Contains(key, prms)) Remove(key, prms); CacheItemPolicy policy = new CacheItemPolicy(); DateTime dt = DateTime.Now; policy.AbsoluteExpiration = dt + TimeSpan.FromSeconds(cacheTime); lock (Cache) { Cache.Add(new CacheItem(key.ToString() + GetKeyByParams(prms), data), policy); } }