protected class BlogCacheManager.PostTagCache extends Object
Modifier and Type | Field and Description |
---|---|
private Map<String,Map<String,BlogCacheManager.Post>> |
_posts
The posts, indexed by tag and ID.
|
Constructor and Description |
---|
PostTagCache()
Construct a PostTagCache instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addPost(BlogCacheManager.Post post,
String tagId)
Add a post to the cache.
|
void |
addPost(Content content,
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.
|
public PostTagCache()
public boolean hasTag(String tagId)
tagId
- The id of tagpublic Set<String> getTags()
public Map<String,BlogCacheManager.Post> getPosts(String tagId)
tagId
- the year.public void addPost(Content content, String tagId)
content
- The contenttagId
- the tag ID.public void addPost(BlogCacheManager.Post post, String tagId)
post
- the posttagId
- the tag ID.public void removePost(String contentId, String tagId)
contentId
- The id of contenttagId
- the id of tagpublic BlogCacheManager.Post getPost(String tagId, String id)
tagId
- the tag id.id
- the post ID.public boolean hasPost(String tagId, String id)
tagId
- the tag id.id
- the post ID.public BlogCacheManager.Post getPostByName(String tagId, String name)
tagId
- the year.name
- The name of postpublic boolean hasPostByName(String tagId, String name)
tagId
- the year.name
- the name of postpublic void clear()
protected Map<String,BlogCacheManager.Post> getOrCreatePostMap(String tagId)
tagId
- the year.