2013-06-28 17:02:29 +02:00
|
|
|
package com.commafeed.backend.cache;
|
|
|
|
|
|
2013-06-29 11:20:53 +02:00
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.codec.digest.DigestUtils;
|
2013-06-28 17:02:29 +02:00
|
|
|
|
|
|
|
|
import com.commafeed.backend.model.Feed;
|
|
|
|
|
import com.commafeed.backend.model.FeedEntry;
|
2013-07-25 10:21:11 +02:00
|
|
|
import com.commafeed.backend.model.FeedSubscription;
|
2013-07-02 18:07:08 +02:00
|
|
|
import com.commafeed.backend.model.User;
|
2013-07-25 10:38:23 +02:00
|
|
|
import com.commafeed.frontend.model.Category;
|
2013-08-08 17:00:35 +02:00
|
|
|
import com.commafeed.frontend.model.UnreadCount;
|
2013-06-28 17:02:29 +02:00
|
|
|
|
2013-06-29 11:20:53 +02:00
|
|
|
public abstract class CacheService {
|
2013-06-28 17:02:29 +02:00
|
|
|
|
2013-07-25 10:21:11 +02:00
|
|
|
// feed entries for faster refresh
|
2013-06-29 11:20:53 +02:00
|
|
|
public abstract List<String> getLastEntries(Feed feed);
|
2013-06-28 17:02:29 +02:00
|
|
|
|
2013-06-29 11:20:53 +02:00
|
|
|
public abstract void setLastEntries(Feed feed, List<String> entries);
|
2013-06-28 17:02:29 +02:00
|
|
|
|
2013-07-02 18:07:08 +02:00
|
|
|
public String buildUniqueEntryKey(Feed feed, FeedEntry entry) {
|
2013-07-25 09:17:33 +02:00
|
|
|
return DigestUtils.sha1Hex(entry.getGuid() + entry.getUrl());
|
2013-06-28 17:02:29 +02:00
|
|
|
}
|
2013-06-29 11:20:53 +02:00
|
|
|
|
2013-07-25 10:21:11 +02:00
|
|
|
// user categories
|
2013-07-25 10:38:23 +02:00
|
|
|
public abstract Category getUserRootCategory(User user);
|
2013-07-02 18:07:08 +02:00
|
|
|
|
2013-07-25 10:38:23 +02:00
|
|
|
public abstract void setUserRootCategory(User user, Category category);
|
2013-07-25 09:17:33 +02:00
|
|
|
|
2013-07-25 10:38:23 +02:00
|
|
|
public abstract void invalidateUserRootCategory(User... users);
|
2013-07-25 10:21:11 +02:00
|
|
|
|
|
|
|
|
// unread count
|
2013-08-08 17:00:35 +02:00
|
|
|
public abstract UnreadCount getUnreadCount(FeedSubscription sub);
|
2013-07-25 10:21:11 +02:00
|
|
|
|
2013-08-08 17:00:35 +02:00
|
|
|
public abstract void setUnreadCount(FeedSubscription sub, UnreadCount count);
|
2013-07-25 10:21:11 +02:00
|
|
|
|
|
|
|
|
public abstract void invalidateUnreadCount(FeedSubscription... subs);
|
2013-07-02 18:07:08 +02:00
|
|
|
|
2013-06-28 17:02:29 +02:00
|
|
|
}
|