Exemplo n.º 1
0
 @Aop("redis")
 public void fillTopic(Topic topic, Map<Integer, UserProfile> authors) {
   if (topic.getUserId() == 0) topic.setUserId(1);
   topic.setAuthor(_cacheFetch(authors, topic.getUserId()));
   Double reply_count = jedis().zscore(RKEY_REPLY_COUNT, topic.getId());
   topic.setReplyCount(reply_count == null ? 0 : reply_count.intValue());
   if (topic.getReplyCount() > 0) {
     String replyId = jedis().hget(RKEY_REPLY_LAST, topic.getId());
     TopicReply reply = dao.fetch(TopicReply.class, replyId);
     if (reply != null) {
       if (reply.getUserId() == 0) reply.setUserId(1);
       reply.setAuthor(_cacheFetch(authors, reply.getUserId()));
       topic.setLastComment(reply);
     }
   }
   Double visited = jedis().zscore(RKEY_TOPIC_VISIT, topic.getId());
   topic.setVisitCount((visited == null) ? 0 : visited.intValue());
 }