Package org.ametys.plugins.blog
Class BlogCacheManager.PostTagCache
- java.lang.Object
-
- org.ametys.plugins.blog.BlogCacheManager.PostTagCache
-
- Enclosing class:
- BlogCacheManager
protected class BlogCacheManager.PostTagCache extends Object
Post cache by tag.
-
-
Constructor Summary
Constructors Constructor Description PostTagCache()
Construct a PostTagCache instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPost(Content content, String tagId)
Add a post to the cache.void
addPost(BlogCacheManager.Post post, String tagId)
Add a post to the cache.void
clear()
Clear the cache.protected Map<String,BlogCacheManager.Post>
getOrCreatePostMap(String tagId)
Get or create the post set for the specified year and month.BlogCacheManager.Post
getPost(String tagId, String id)
Test if the post with the given ID exists for this year and month.BlogCacheManager.Post
getPostByName(String tagId, String name)
Get the posts for a year-month couple.Map<String,BlogCacheManager.Post>
getPosts(String tagId)
Get the posts for a year-month couple.Set<String>
getTags()
Get the years with posts.boolean
hasPost(String tagId, String id)
Test if the post with the given ID exists for this year and month.boolean
hasPostByName(String tagId, String name)
Get the posts for a year-month couple.boolean
hasTag(String tagId)
Get the years with posts.void
removePost(String contentId, String tagId)
Remove a post from the cache.
-
-
-
Constructor Detail
-
PostTagCache
public PostTagCache()
Construct a PostTagCache instance.
-
-
Method Detail
-
hasTag
public boolean hasTag(String tagId)
Get the years with posts.- Parameters:
tagId
- The id of tag- Returns:
- the years with posts as a Set of Integer.
-
getTags
public Set<String> getTags()
Get the years with posts.- Returns:
- the years with posts as a Set of Integer.
-
getPosts
public Map<String,BlogCacheManager.Post> getPosts(String tagId)
Get the posts for a year-month couple.- Parameters:
tagId
- the year.- Returns:
- the posts in the specified year and month.
-
addPost
public void addPost(Content content, String tagId)
Add a post to the cache.- Parameters:
content
- The contenttagId
- the tag ID.
-
addPost
public void addPost(BlogCacheManager.Post post, String tagId)
Add a post to the cache.- Parameters:
post
- the posttagId
- the tag ID.
-
removePost
public void removePost(String contentId, String tagId)
Remove a post from the cache.- Parameters:
contentId
- The id of contenttagId
- the id of tag
-
getPost
public BlogCacheManager.Post getPost(String tagId, String id)
Test if the post with the given ID exists for this year and month.- Parameters:
tagId
- the tag id.id
- the post ID.- Returns:
- the posts in the specified year and month.
-
hasPost
public boolean hasPost(String tagId, String id)
Test if the post with the given ID exists for this year and month.- Parameters:
tagId
- the tag id.id
- the post ID.- Returns:
- the posts in the specified year and month.
-
getPostByName
public BlogCacheManager.Post getPostByName(String tagId, String name)
Get the posts for a year-month couple.- Parameters:
tagId
- the year.name
- The name of post- Returns:
- the posts in the specified year and month.
-
hasPostByName
public boolean hasPostByName(String tagId, String name)
Get the posts for a year-month couple.- Parameters:
tagId
- the year.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(String tagId)
Get or create the post set for the specified year and month.- Parameters:
tagId
- the year.- Returns:
- the post set, indexed by id.
-
-