Example #1
0
        public static PersonInfo GetItem(int Id)
        {
            if (itemCacheTimeout <= 0)
            {
                return(Select.WhereId(Id).ToOne());
            }
            string key   = string.Concat("user_BLL_Person_", Id);
            string value = RedisHelper.Get(key);

            if (!string.IsNullOrEmpty(value))
            {
                try { return(PersonInfo.Parse(value)); } catch { }
            }
            PersonInfo item = Select.WhereId(Id).ToOne();

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