Ejemplo n.º 1
0
        public static MomentEntity GetMoment(Guid momentId)
        {
            string cacheKey = RedisKeyConst.MomentCacheKey(momentId);
            var    moment   = redisClient.Get <MomentEntity>(cacheKey);

            if (moment != null)
            {
                return(moment);
            }
            moment = momentDao.GetMomentByMomentId(momentId);
            if (moment != null)
            {
                //缓存一个月
                redisClient.Set(cacheKey, moment, RedisKeyConst.UserInfoCacheSecond);
            }
            return(moment);
        }