public static T Get(string refID) { ICacheFactory cf = new CF(); ICache cache = cf.GetCacheManager(); string keyName = MakeKeyName(refID); CacheValueRefID <V, T, CF> item = cache.Get <CacheValueRefID <V, T, CF> >(keyName); if (item != null) { item.Remove(); item = null; } if (item == null) { item = new T(); item.RefID = refID; item.SetValue(item.GetFromSource()); if (!item.IsDefaultData()) { cache.Add(keyName, item); } } return((T)item); }
public static T GetCached(string refID) { ICacheFactory cf = new CF(); ICache cache = cf.GetCacheManager(); string keyName = MakeKeyName(refID); CacheValueRefID <V, T, CF> item = cache.Get <CacheValueRefID <V, T, CF> >(keyName); if (item != null) { item.Remove(); item = null; } return((T)item); }