Class BlogCacheManager.PostDateCache

java.lang.Object
org.ametys.plugins.blog.BlogCacheManager.PostDateCache
Enclosing class:
BlogCacheManager

protected static class BlogCacheManager.PostDateCache extends Object
Post cache by date.
  • Constructor Details

    • PostDateCache

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

    • 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<Integer> getYears()
      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<Integer> getMonths(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

      Get the posts for a year couple.
      Parameters:
      year - the year.
      Returns:
      the posts in the specified year.
    • getPosts

      public Map<String,BlogCacheManager.Post> getPosts(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.Post> getOrCreatePostMap(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.