コード例 #1
0
ファイル: CountingService.java プロジェクト: hapiman/expper
  public void loadPostCounting(Long postId) {
    Post post = postRepository.findOne(postId);

    counting.put(CACHE_VOTE, "votes_up_" + postId, post.getVotesUp());
    counting.put(CACHE_VOTE, "votes_down_" + postId, post.getVotesDown());
    counting.put(CACHE_REPLIES, postId.toString(), post.getReplies());
    counting.put(CACHE_PAGE_VIEWS, "/posts/" + postId, post.getHits());
  }
コード例 #2
0
ファイル: CountingService.java プロジェクト: hapiman/expper
  public Integer getPublicPostsCount() {
    Integer val = counting.get(CACHE_COUNTING, "public_posts");
    if (val == null) {
      val = (int) postRepository.countPublicPost();
      counting.put(CACHE_COUNTING, "public_posts", val);
    }

    return val;
  }