Beispiel #1
0
  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());
  }
Beispiel #2
0
  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;
  }