Example #1
0
        public static T Get(string refID)
        {
            ICacheFactory            cf      = new CF();
            ICache                   cache   = cf.GetCacheManager();
            string                   keyName = MakeKeyName(refID);
            CacheConfigRefID <T, CF> item    = cache.Get <CacheConfigRefID <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);
        }
Example #2
0
        public static T GetCached(string refID)
        {
            ICacheFactory            cf      = new CF();
            ICache                   cache   = cf.GetCacheManager();
            string                   keyName = MakeKeyName(refID);
            CacheConfigRefID <T, CF> item    = cache.Get <CacheConfigRefID <T, CF> >(keyName);

            if (item != null)
            {
                item.Remove();
                item = null;
            }
            return((T)item);
        }