Package org.ametys.plugins.blog
Class BlogCacheManager.FuturePostCache
- java.lang.Object
-
- org.ametys.plugins.blog.BlogCacheManager.FuturePostCache
-
- Enclosing class:
- BlogCacheManager
protected class BlogCacheManager.FuturePostCache extends Object
Cache of identifier of the future posts.
-
-
Field Summary
Fields Modifier and Type Field Description private Map<String,BlogCacheManager.Post>
_posts
The posts, indexed by ID.private Multimap<ZonedDateTime,String>
_sortedPostIds
The posts id, indexed by date.
-
Constructor Summary
Constructors Constructor Description FuturePostCache()
Construct a AllPostCache instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPost(Content content)
Add a post to the cache.void
clear()
Clear the cache.BlogCacheManager.Post
getPost(String id)
Test if a post exists, provided its ID.boolean
hasPost(String id)
Test if a post exists, provided its ID.Collection<BlogCacheManager.Post>
removePastPosts()
Remove the post that are not future anymore (given the current date)void
removePost(Content content)
Remove a post from the cache.void
removePost(BlogCacheManager.Post post)
Remove a post from the cache.
-
-
-
Field Detail
-
_posts
private Map<String,BlogCacheManager.Post> _posts
The posts, indexed by ID.
-
_sortedPostIds
private Multimap<ZonedDateTime,String> _sortedPostIds
The posts id, indexed by date.
-
-
Constructor Detail
-
FuturePostCache
public FuturePostCache()
Construct a AllPostCache instance.
-
-
Method Detail
-
removePastPosts
public Collection<BlogCacheManager.Post> removePastPosts()
Remove the post that are not future anymore (given the current date)- Returns:
- The collection of past 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.
-
addPost
public void addPost(Content content)
Add a post to the cache.- Parameters:
content
- the post content.
-
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(BlogCacheManager.Post post)
Remove a post from the cache.- Parameters:
post
- the post content to remove from the cache.
-
clear
public void clear()
Clear the cache.
-
-