protected class BlogCacheManager.PostDateCache extends Object
Modifier and Type | Field and Description |
---|---|
private Map<Integer,Map<Integer,Map<String,BlogCacheManager.Post>>> |
_posts
The posts, indexed by year, month and ID.
|
Constructor and Description |
---|
PostDateCache()
Construct a PostDateCache instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addPost(BlogCacheManager.Post post,
int year,
int month)
Add a post to the cache.
|
void |
addPost(Content content,
int year,
int month)
Add a post to the cache.
|
void |
clear()
Clear the cache.
|
Set<Integer> |
getMonths(int year)
Get the months with posts for a specified year.
|
protected Map<String,BlogCacheManager.Post> |
getOrCreatePostMap(int year,
int month)
Get or create the post set for the specified year and month.
|
BlogCacheManager.Post |
getPostByName(int year,
int month,
String name)
Get the posts for a year-month couple.
|
Map<String,BlogCacheManager.Post> |
getPosts(int year)
Get the posts for a year couple.
|
Map<String,BlogCacheManager.Post> |
getPosts(int year,
int month)
Get the posts for a year-month couple.
|
Set<Integer> |
getYears()
Get the years with posts.
|
boolean |
hasMonth(int year,
int month)
Determines if the page month exists in given year
|
boolean |
hasPost(int year,
int month,
String id)
Test if the post with the given ID exists for this year and month.
|
boolean |
hasPostByName(int year,
int month,
String name)
Get the posts for a year-month couple.
|
boolean |
hasYear(int year)
Determines if the year page exists
|
void |
removePost(String contentId,
int year,
int month)
Remove a post from the cache.
|
public PostDateCache()
public boolean hasYear(int year)
year
- the yearpublic Set<Integer> getYears()
public boolean hasMonth(int year, int month)
year
- The yearmonth
- The monthpublic Set<Integer> getMonths(int year)
year
- the year.public Map<String,BlogCacheManager.Post> getPosts(int year)
year
- the year.public Map<String,BlogCacheManager.Post> getPosts(int year, int month)
year
- the year.month
- the month.public void addPost(Content content, int year, int month)
content
- The contentyear
- the yearmonth
- the monthpublic void addPost(BlogCacheManager.Post post, int year, int month)
post
- the postyear
- the year of the postmonth
- the month of the postpublic void removePost(String contentId, int year, int month)
contentId
- The content idyear
- the yearmonth
- the monthpublic boolean hasPost(int year, int month, String id)
year
- the year.month
- the month.id
- the id of postpublic BlogCacheManager.Post getPostByName(int year, int month, String name)
year
- the year.month
- the month.name
- the name of postpublic boolean hasPostByName(int year, int month, String name)
year
- the year.month
- the month.name
- the name of postpublic void clear()
protected Map<String,BlogCacheManager.Post> getOrCreatePostMap(int year, int month)
year
- the year.month
- the month.