Package org.ametys.plugins.blog
Class BlogCacheManager.AllPostCache
- java.lang.Object
-
- org.ametys.plugins.blog.BlogCacheManager.AllPostCache
-
- Enclosing class:
- BlogCacheManager
protected class BlogCacheManager.AllPostCache extends Object
Cache of all the posts.
-
-
Field Summary
Fields Modifier and Type Field Description private Map<String,BlogCacheManager.Post>_postsThe posts, indexed by ID.private Map<String,BlogCacheManager.Post>_postsByNameThe posts, indexed by name.
-
Constructor Summary
Constructors Constructor Description AllPostCache()Construct a AllPostCache instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPost(Content content)Add a post to the cache.voidaddPost(BlogCacheManager.Post post)Add a post to the cache.voidclear()Clear the cache.BlogCacheManager.PostgetPost(String id)Test if a post exists, provided its ID.BlogCacheManager.PostgetPostByName(String name)Test if a post exists, provided its content name.Set<String>getPostIds()Get a list of all the posts' IDs.Map<String,BlogCacheManager.Post>getPosts()Get the exhaustive list of Posts.booleanhasPost(String id)Test if a post exists, provided its ID.booleanhasPostByName(String name)Test if a post exists, provided its content name.voidremovePost(String id, String name)Remove a post from the cache.voidremovePost(Content content)Remove a post from the cache.
-
-
-
Field Detail
-
_posts
private Map<String,BlogCacheManager.Post> _posts
The posts, indexed by ID.
-
_postsByName
private Map<String,BlogCacheManager.Post> _postsByName
The posts, indexed by name.
-
-
Constructor Detail
-
AllPostCache
public AllPostCache()
Construct a AllPostCache instance.
-
-
Method Detail
-
getPostIds
public Set<String> getPostIds()
Get a list of all the posts' IDs.- Returns:
- all the posts' IDs as a Set.
-
getPosts
public Map<String,BlogCacheManager.Post> getPosts()
Get the exhaustive list of Posts.- Returns:
- the exhaustive list of Posts.
-
getPost
public BlogCacheManager.Post getPost(String id)
Test if a post exists, provided its ID.- Parameters:
id- the post content ID.- Returns:
- true if the post exists.
-
hasPost
public boolean hasPost(String id)
Test if a post exists, provided its ID.- Parameters:
id- the post content ID.- Returns:
- true if the post exists.
-
getPostByName
public BlogCacheManager.Post getPostByName(String name)
Test if a post exists, provided its content name.- Parameters:
name- the post content name.- Returns:
- true if the post exists.
-
hasPostByName
public boolean hasPostByName(String name)
Test if a post exists, provided its content name.- Parameters:
name- the post content name.- Returns:
- true if the post exists.
-
addPost
public void addPost(Content content)
Add a post to the cache.- Parameters:
content- the post content.
-
addPost
public void addPost(BlogCacheManager.Post post)
Add a post to the cache.- Parameters:
post- The post
-
removePost
public void removePost(Content content)
Remove a post from the cache.- Parameters:
content- the post content to remove from the cache.
-
removePost
public void removePost(String id, String name)
Remove a post from the cache.- Parameters:
id- The id of postname- The name of post
-
clear
public void clear()
Clear the cache.
-
-