コード例 #1
0
        public static ShopInfo GetItemByCode(string Code)
        {
            if (itemCacheTimeout <= 0)
            {
                return(Select.WhereCode(Code).ToOne());
            }
            string key   = string.Concat("pifa_BLL_ShopByCode_", Code);
            string value = RedisHelper.Get(key);

            if (!string.IsNullOrEmpty(value))
            {
                try { return(ShopInfo.Parse(value)); } catch { }
            }
            ShopInfo item = Select.WhereCode(Code).ToOne();

            if (item == null)
            {
                return(null);
            }
            RedisHelper.Set(key, item.Stringify(), itemCacheTimeout);
            return(item);
        }