Class BlogCacheManager.PostDateCache

    • Constructor Detail

      • PostDateCache

        public PostDateCache()
        Construct a PostDateCache instance.
    • Method Detail

      • hasYear

        public boolean hasYear​(int year)
        Determines if the year page exists
        Parameters:
        year - the year
        Returns:
        true if there are posts for this year
      • getYears

        public Set<IntegergetYears()
        Get the years with posts.
        Returns:
        the years with posts as a Set of Integer.
      • hasMonth

        public boolean hasMonth​(int year,
                                int month)
        Determines if the page month exists in given year
        Parameters:
        year - The year
        month - The month
        Returns:
        true if there are posts for this year/month couple
      • getMonths

        public Set<IntegergetMonths​(int year)
        Get the months with posts for a specified year.
        Parameters:
        year - the year.
        Returns:
        the months with posts in the specified year as a Set of Integer.
      • getPosts

        public Map<String,​BlogCacheManager.PostgetPosts​(int year,
                                                                int month)
        Get the posts for a year-month couple.
        Parameters:
        year - the year.
        month - the month.
        Returns:
        the posts in the specified year and month.
      • addPost

        public void addPost​(Content content,
                            int year,
                            int month)
        Add a post to the cache.
        Parameters:
        content - The content
        year - the year
        month - the month
      • addPost

        public void addPost​(BlogCacheManager.Post post,
                            int year,
                            int month)
        Add a post to the cache.
        Parameters:
        post - the post
        year - the year of the post
        month - the month of the post
      • removePost

        public void removePost​(String contentId,
                               int year,
                               int month)
        Remove a post from the cache.
        Parameters:
        contentId - The content id
        year - the year
        month - the month
      • hasPost

        public boolean hasPost​(int year,
                               int month,
                               String id)
        Test if the post with the given ID exists for this year and month.
        Parameters:
        year - the year.
        month - the month.
        id - the id of post
        Returns:
        the posts in the specified year and month.
      • getPostByName

        public BlogCacheManager.Post getPostByName​(int year,
                                                   int month,
                                                   String name)
        Get the posts for a year-month couple.
        Parameters:
        year - the year.
        month - the month.
        name - the name of post
        Returns:
        the posts in the specified year and month.
      • hasPostByName

        public boolean hasPostByName​(int year,
                                     int month,
                                     String name)
        Get the posts for a year-month couple.
        Parameters:
        year - the year.
        month - the month.
        name - the name of post
        Returns:
        the posts in the specified year and month.
      • clear

        public void clear()
        Clear the cache.
      • getOrCreatePostMap

        protected Map<String,​BlogCacheManager.PostgetOrCreatePostMap​(int year,
                                                                             int month)
        Get or create the post set for the specified year and month.
        Parameters:
        year - the year.
        month - the month.
        Returns:
        the post set.