metrics for entry cache

This commit is contained in:
Athou
2013-06-28 22:31:40 +02:00
parent fbd0feb6e7
commit 8c080a581e
2 changed files with 16 additions and 2 deletions

View File

@@ -64,6 +64,16 @@ public class MetricsBean {
thisMinute.statusesInserted += statusesCount;
}
public void entryCacheHit() {
thisHour.entryCacheHit++;
thisMinute.entryCacheHit++;
}
public void entryCacheMiss() {
thisHour.entryCacheMiss++;
thisMinute.entryCacheMiss++;
}
public void pushReceived(int feedCount) {
thisHour.pushNotificationsReceived++;
@@ -101,6 +111,8 @@ public class MetricsBean {
private int threadWaited;
private int pushNotificationsReceived;
private int pushFeedsQueued;
private int entryCacheHit;
private int entryCacheMiss;
public int getFeedsRefreshed() {
return feedsRefreshed;

View File

@@ -172,11 +172,13 @@ public class FeedRefreshUpdater {
locked = lock.tryLock(1, TimeUnit.MINUTES);
if (locked) {
if (!cache.hasFeedEntry(feed, entry)) {
log.info("cache miss for {}", entry.getUrl());
log.debug("cache miss for {}", entry.getUrl());
feedUpdateService.updateEntry(feed, entry, subscriptions);
cache.putFeedEntry(feed, entry);
metricsBean.entryCacheMiss();
} else {
log.info("cache hit for {}", entry.getUrl());
log.debug("cache hit for {}", entry.getUrl());
metricsBean.entryCacheHit();
}
success = true;
} else {