cache the "tree"

This commit is contained in:
Athou
2013-07-02 18:07:08 +02:00
parent 18016c952e
commit f0f1a7f87b
15 changed files with 216 additions and 76 deletions

View File

@@ -106,7 +106,7 @@ public class FeedRefreshUpdater {
List<FeedSubscription> subscriptions = null;
for (FeedEntry entry : entries) {
String cacheKey = cache.buildKey(feed, entry);
String cacheKey = cache.buildUniqueEntryKey(feed, entry);
if (!lastEntries.contains(cacheKey)) {
log.debug("cache miss for {}", entry.getUrl());
if (subscriptions == null) {

View File

@@ -13,6 +13,7 @@ import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.commafeed.backend.cache.CacheService;
import com.commafeed.backend.dao.FeedCategoryDAO;
import com.commafeed.backend.model.FeedCategory;
import com.commafeed.backend.model.User;
@@ -34,6 +35,9 @@ public class OPMLImporter {
@Inject
FeedCategoryDAO feedCategoryDAO;
@Inject
CacheService cache;
@SuppressWarnings("unchecked")
@Asynchronous
public void importOpml(User user, String xml) {
@@ -77,16 +81,17 @@ public class OPMLImporter {
if (StringUtils.isBlank(title)) {
title = "Unnamed subscription";
}
// make sure we continue with the import process even a feed failed
try {
feedSubscriptionService.subscribe(user, outline.getXmlUrl(), title,
parent);
} catch (FeedSubscriptionException e) {
throw e;
} catch (Exception e) {
log.error("error while importing {}: {}", outline.getXmlUrl(), e.getMessage());
}
}
cache.invalidateRootCategory(user);
}
}