public void Add(string key, object value, string filepath, DateTime dateTime, OnCacheRemoved onCacheRemoved) { if (!enableCache) return; CacheDependency dep = null; if (!string.IsNullOrEmpty(filepath)) { dep = new CacheDependency(filepath); } CacheItemRemovedCallback onRemoveCallback = null; if (onCacheRemoved != null) { AspCachingOnRemove aspCachingOnRemove = new AspCachingOnRemove(); onRemoveCallback = new CacheItemRemovedCallback(aspCachingOnRemove.RemovedCallback); aspCachingOnRemove.RemoveEvent += new AspCachingOnRemove.RemoveHandler(onCacheRemoved.RemoveHandler); } cache.Insert(key, value, dep, dateTime, TimeSpan.Zero, CacheItemPriority.NotRemovable, onRemoveCallback); }
public void Add(string key, object value, DateTime dateTime, OnCacheRemoved onCacheRemoved) { Add(key, value, string.Empty, dateTime, onCacheRemoved); }
public void Add(string key, object value, string filepath, OnCacheRemoved onCacheRemoved) { Add(key, value, filepath, DateTime.Now.AddDays(1), onCacheRemoved); }
public void Add(string key, object value, int minutes, OnCacheRemoved onCacheRemoved) { Add(key, value, DateTime.Now.AddMinutes(minutes), onCacheRemoved); }