From 2bc3cba6f100de6465de24c4799c1aacaf740282 Mon Sep 17 00:00:00 2001 From: orbiter Date: Sat, 24 Apr 2010 08:22:45 +0000 Subject: [PATCH] - fix for 'do not write to cache' rule. - do not read from cache if byte[] array is still filled from response object (will do less IO) git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6836 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/search/Switchboard.java | 7 ++++--- source/net/yacy/repository/LoaderDispatcher.java | 6 ++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/source/de/anomic/search/Switchboard.java b/source/de/anomic/search/Switchboard.java index 84e19b51d..98a18e4e1 100644 --- a/source/de/anomic/search/Switchboard.java +++ b/source/de/anomic/search/Switchboard.java @@ -1639,9 +1639,10 @@ public final class Switchboard extends serverSwitch { // PARSE CONTENT final long parsingStartTime = System.currentTimeMillis(); - byte[] b = null; - try { - // fetch the document + // fetch the document from the response + byte[] b = response.getContent(); + if (b == null) try { + // fetch the document from cache b = Cache.getContent(response.url()); if (b == null) { this.log.logWarning("the resource '" + response.url() + "' is missing in the cache."); diff --git a/source/net/yacy/repository/LoaderDispatcher.java b/source/net/yacy/repository/LoaderDispatcher.java index 6679906ed..e33f01fcf 100644 --- a/source/net/yacy/repository/LoaderDispatcher.java +++ b/source/net/yacy/repository/LoaderDispatcher.java @@ -264,6 +264,12 @@ public final class LoaderDispatcher { if (protocol.equals("smb")) response = smbLoader.load(request, true); if (response != null) { // we got something. Now check if we want to store that to the cache + // first check looks if we want to store the content to the cache + if (!crawlProfile.storeHTCache()) { + // no caching wanted. Thats ok, do not write any message + return response; + } + // second check tells us if the protocoll tells us something about caching String storeError = response.shallStoreCacheForCrawler(); if (storeError == null) { try {