- 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
pull/1/head
orbiter 15 years ago
parent 4cd5418963
commit 2bc3cba6f1

@ -1639,9 +1639,10 @@ public final class Switchboard extends serverSwitch {
// PARSE CONTENT // PARSE CONTENT
final long parsingStartTime = System.currentTimeMillis(); final long parsingStartTime = System.currentTimeMillis();
byte[] b = null; // fetch the document from the response
try { byte[] b = response.getContent();
// fetch the document if (b == null) try {
// fetch the document from cache
b = Cache.getContent(response.url()); b = Cache.getContent(response.url());
if (b == null) { if (b == null) {
this.log.logWarning("the resource '" + response.url() + "' is missing in the cache."); this.log.logWarning("the resource '" + response.url() + "' is missing in the cache.");

@ -264,6 +264,12 @@ public final class LoaderDispatcher {
if (protocol.equals("smb")) response = smbLoader.load(request, true); if (protocol.equals("smb")) response = smbLoader.load(request, true);
if (response != null) { if (response != null) {
// we got something. Now check if we want to store that to the cache // 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(); String storeError = response.shallStoreCacheForCrawler();
if (storeError == null) { if (storeError == null) {
try { try {

Loading…
Cancel
Save