/// <summary> /// 获取解析后的内容 /// </summary> /// <param name="microblogId">微博Id</param> /// <returns></returns> public string GetResolvedBody(long microblogId) { MicroblogEntity microblog = Get(microblogId); if (microblog == null) { return(string.Empty); } string cacheKey = string.Format("ResolvedBody{0}::{1}", RealTimeCacheHelper.GetEntityVersion(microblogId), microblogId); string resolveBody = cacheService.Get <string>(cacheKey); if (string.IsNullOrEmpty(resolveBody)) { resolveBody = microblog.Body; IMicroblogBodyProcessor microblogBodyProcessor = DIContainer.Resolve <IMicroblogBodyProcessor>(); resolveBody = microblogBodyProcessor.Process(resolveBody, microblog.TenantTypeId, microblog.MicroblogId, microblog.UserId, microblog.OwnerId); cacheService.Set(cacheKey, resolveBody, CachingExpirationType.UsualSingleObject); } return(resolveBody); }
/// <summary> /// 获取解析后的内容 /// </summary> /// <param name="id">评论Id</param> /// <returns></returns> public string GetResolvedBody(long id) { Comment comment = Get(id); if (comment == null) { return(string.Empty); } ICacheService cacheService = DIContainer.Resolve <ICacheService>(); string cacheKey = string.Format("CommentResolvedBody{0}::{1}", RealTimeCacheHelper.GetEntityVersion(id), id); string resolveBody = cacheService.Get <string>(cacheKey); if (string.IsNullOrEmpty(resolveBody)) { resolveBody = comment.Body; ICommentBodyProcessor commentBodyProcessor = DIContainer.Resolve <ICommentBodyProcessor>(); resolveBody = commentBodyProcessor.Process(comment.Body, TenantTypeIds.Instance().Comment(), comment.Id, comment.UserId); cacheService.Set(cacheKey, resolveBody, CachingExpirationType.SingleObject); } return(resolveBody); }