diff --git a/htroot/ProxyIndexingMonitor_p.java b/htroot/ProxyIndexingMonitor_p.java index a8e282b86..77a1b919c 100644 --- a/htroot/ProxyIndexingMonitor_p.java +++ b/htroot/ProxyIndexingMonitor_p.java @@ -4,7 +4,10 @@ // (C) by Michael Peter Christen; mc@anomic.de // first published on http://www.anomic.de // Frankfurt, Germany, 2004 -// last change: 02.05.2004 +// +// $LastChangedDate$ +// $LastChangedRevision$ +// $LastChangedBy$ // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -65,13 +68,13 @@ public class ProxyIndexingMonitor_p { public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) { // return variable that accumulates replacements - plasmaSwitchboard switchboard = (plasmaSwitchboard) env; + plasmaSwitchboard sb = (plasmaSwitchboard) env; serverObjects prop = new serverObjects(); // int showIndexedCount = 20; // boolean se = false; - String oldProxyCache, newProxyCache; + String oldProxyCachePath, newProxyCachePath; String oldProxyCacheSize, newProxyCacheSize; prop.put("info", 0); @@ -90,23 +93,25 @@ public class ProxyIndexingMonitor_p { // added proxyCache, proxyCacheSize - Borg-0300 // proxyCache - check and create the directory - oldProxyCache = env.getConfig("proxyCache", "DATA/HTCACHE"); - newProxyCache = ((String) post.get("proxyCache", "DATA/HTCACHE")); - newProxyCache = newProxyCache.replace('\\', '/'); - if (newProxyCache.endsWith("/")) { - newProxyCache.substring(0, newProxyCache.length() - 1); + oldProxyCachePath = env.getConfig("proxyCache", "DATA/HTCACHE"); + newProxyCachePath = post.get("proxyCache", "DATA/HTCACHE"); + newProxyCachePath = newProxyCachePath.replace('\\', '/'); + if (newProxyCachePath.endsWith("/")) { + newProxyCachePath.substring(0, newProxyCachePath.length() - 1); } - final File cache = new File(newProxyCache); - if ((!cache.isDirectory()) && (!cache.isFile())) cache.mkdirs(); - env.setConfig("proxyCache", newProxyCache); + final File cache = new File(newProxyCachePath); + if (!cache.isDirectory() && !cache.isFile()) cache.mkdirs(); + env.setConfig("proxyCache", newProxyCachePath); // proxyCacheSize - oldProxyCacheSize = Integer.toString(Integer.parseInt(env.getConfig("proxyCacheSize", "64"))); - newProxyCacheSize = Integer.toString(Integer.parseInt((String) post.get("proxyCacheSize", "64"))); + oldProxyCacheSize = getStringLong(env.getConfig("proxyCacheSize", "64")); + newProxyCacheSize = getStringLong(post.get("proxyCacheSize", "64")); + if (getLong(newProxyCacheSize) < 4) { newProxyCacheSize = "4"; } env.setConfig("proxyCacheSize", newProxyCacheSize); + sb.setCacheSize(Long.parseLong(newProxyCacheSize)); // implant these settings also into the crawling profile for the proxy - plasmaCrawlProfile.entry profile = switchboard.profiles.getEntry(switchboard.getConfig("defaultProxyProfile", "")); + plasmaCrawlProfile.entry profile = sb.profiles.getEntry(sb.getConfig("defaultProxyProfile", "")); if (profile == null) { prop.put("info", 1); //delete DATA/PLASMADB/crawlProfiles0.db } else { @@ -118,12 +123,12 @@ public class ProxyIndexingMonitor_p { prop.put("info_caching", (proxyStoreHTCache) ? 1 : 0); // proxyCache - only display on change - if (oldProxyCache.equals(newProxyCache)) { + if (oldProxyCachePath.equals(newProxyCachePath)) { prop.put("info_path", 0); - prop.put("info_path_return", oldProxyCache); + prop.put("info_path_return", oldProxyCachePath); } else { prop.put("info_path", 1); - prop.put("info_path_return", newProxyCache); + prop.put("info_path_return", newProxyCachePath); } // proxyCacheSize - only display on change if (oldProxyCacheSize.equals(newProxyCacheSize)) { @@ -133,11 +138,11 @@ public class ProxyIndexingMonitor_p { prop.put("info_size", 1); prop.put("info_size_return", newProxyCacheSize); } - // proxyCache, proxyCacheSize we need a restart + // proxyCache, proxyCacheSize we need a restart prop.put("info_restart", 0); prop.put("info_restart_return", 0); - if (!oldProxyCache.equals(newProxyCache)) prop.put("info_restart", 1); - if (!oldProxyCacheSize.equals(newProxyCacheSize)) prop.put("info_restart", 1); + if (!oldProxyCachePath.equals(newProxyCachePath)) prop.put("info_restart", 1); +// if (!oldProxyCacheSize.equals(newProxyCacheSize)) prop.put("info_restart", 1); } catch (IOException e) { prop.put("info", 3); //Error: errmsg @@ -159,4 +164,21 @@ public class ProxyIndexingMonitor_p { // return rewrite properties return prop; } -} + + public static long getLong(String value) { + try { + return Long.parseLong(value); + } catch (Exception e) { + return 0; + } + } + + public static String getStringLong(String value) { + try { + return Long.toString(Long.parseLong(value)); + } catch (Exception e) { + return "0"; + } + } + +} \ No newline at end of file diff --git a/source/de/anomic/plasma/plasmaHTCache.java b/source/de/anomic/plasma/plasmaHTCache.java index 09bfc984b..2ae42892b 100644 --- a/source/de/anomic/plasma/plasmaHTCache.java +++ b/source/de/anomic/plasma/plasmaHTCache.java @@ -4,7 +4,10 @@ // (C) by Michael Peter Christen; mc@anomic.de // first published on http://www.anomic.de // Frankfurt, Germany, 2004 -// last major change: 12.02.2004 +// +// $LastChangedDate$ +// $LastChangedRevision$ +// $LastChangedBy$ // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -165,8 +168,20 @@ public final class plasmaHTCache { this.responseHeaderDB.set(urlHash, responseHeader); } + /** + * This method changes the HTCache size.
+ * @param new cache size in bytes + */ + public final void setCacheSize(long newCacheSize) { + this.maxCacheSize = newCacheSize; + } + + /** + * This method returns the free HTCache size.
+ * @return the cache size in bytes + */ public long getFreeSize() { - return (this.currCacheSize > this.maxCacheSize) ? 0 : this.maxCacheSize - this.currCacheSize; + return (this.currCacheSize >= this.maxCacheSize) ? 0 : this.maxCacheSize - this.currCacheSize; } public boolean writeFile(URL url, byte[] array) { @@ -414,7 +429,7 @@ public final class plasmaHTCache { * @return URL */ public File getCachePath(URL url) { - // System.out.println("DEBUG: getCachePath: IN=" + url.toString()); +// this.log.logFinest("plasmaHTCache: getCachePath: IN=" + url.toString()); String remotePath = url.getPath(); if (!(remotePath.startsWith("/"))) remotePath = "/" + remotePath; if (remotePath.endsWith("/")) remotePath = remotePath + "ndx"; @@ -424,7 +439,7 @@ public final class plasmaHTCache { remotePath = remotePath.replace(':', '_'); // yes this is not reversible, but that is not needed int port = url.getPort(); if (port < 0) port = 80; - // System.out.println("DEBUG: getCachePath: OUT=" + url.getHost() + ((port == 80) ? "" : ("+" + port)) + remotePath); +// this.log.logFinest("plasmaHTCache: getCachePath: OUT=" + url.getHost() + ((port == 80) ? "" : ("+" + port)) + remotePath); return new File(this.cachePath, url.getHost() + ((port == 80) ? "" : ("+" + port)) + remotePath); } @@ -433,8 +448,8 @@ public final class plasmaHTCache { * from a given storage path */ public static URL getURL(File cachePath, File f) { - // System.out.println("DEBUG: getURL: IN: Path=[" + cachePath + "]"); - // System.out.println("DEBUG: getURL: IN: File=[" + f + "]"); +// this.log.logFinest("plasmaHTCache: getURL: IN: Path=[" + cachePath + "]"); +// this.log.logFinest("plasmaHTCache: getURL: IN: File=[" + f + "]"); String s = f.toString().replace('\\', '/'); String c = cachePath.toString().replace('\\', '/'); int p = s.lastIndexOf(c); @@ -450,20 +465,20 @@ public final class plasmaHTCache { else s = s.substring(0, p) + ":80" + s.substring(p);*/ } - if (s.endsWith("ndx")) s = s.substring(0, s.length() - 3); - // System.out.println("DEBUG: getURL: OUT=" + s); - + if (s.endsWith("ndx")) { s = s.substring(0, s.length() - 3); } +// this.log.logFinest("plasmaHTCache: getURL: OUT=" + s); + try { /* URL url = null; url = new URL("http://" + s); - System.out.println("DEBUG: getURL: URL=" + url.toString()); + this.log.logFinest("plasmaHTCache: getURL: URL=" + url.toString()); return url;//new URL("http://" + s); */ return new URL("http://" + s); } catch (Exception e) { return null; } } - return null; + return null; } public byte[] loadResource(URL url) { @@ -570,7 +585,7 @@ public final class plasmaHTCache { // to be defined later: this.cacheArray = null; } - + public String name() { return this.name; } @@ -595,76 +610,76 @@ public final class plasmaHTCache { } /* - public boolean update() { - return ((status == CACHE_FILL) || (status == CACHE_STALE_RELOAD_GOOD)); - } - */ + public boolean update() { + return ((status == CACHE_FILL) || (status == CACHE_STALE_RELOAD_GOOD)); + } + */ // the following three methods for cache read/write granting shall be as loose as possible // but also as strict as necessary to enable caching of most items - + public String shallStoreCacheForProxy() { // returns NULL if the answer is TRUE // in case of FALSE, the reason as String is returned - + // check profile if (!(this.profile.storeHTCache())) return "storage_not_wanted"; - // decide upon header information if a specific file should be stored to the cache or not - // if the storage was requested by prefetching, the request map is null - - // check status code - if (!((this.responseStatus.startsWith("200")) || (this.responseStatus.startsWith("203")))) return "bad_status_" + this.responseStatus.substring(0,3); - - // check storage location - // sometimes a file name is equal to a path name in the same directory; - // or sometimes a file name is equal a directory name created earlier; - // we cannot match that here in the cache file path and therefore omit writing into the cache - if ((this.cacheFile.getParentFile().isFile()) || (this.cacheFile.isDirectory())) return "path_ambiguous"; - if (this.cacheFile.toString().indexOf("..") >= 0) return "path_dangerous"; + // decide upon header information if a specific file should be stored to the cache or not + // if the storage was requested by prefetching, the request map is null + + // check status code + if (!((this.responseStatus.startsWith("200")) || (this.responseStatus.startsWith("203")))) return "bad_status_" + this.responseStatus.substring(0,3); + + // check storage location + // sometimes a file name is equal to a path name in the same directory; + // or sometimes a file name is equal a directory name created earlier; + // we cannot match that here in the cache file path and therefore omit writing into the cache + if ((this.cacheFile.getParentFile().isFile()) || (this.cacheFile.isDirectory())) return "path_ambiguous"; + if (this.cacheFile.toString().indexOf("..") >= 0) return "path_dangerous"; - // -CGI access in request - // CGI access makes the page very individual, and therefore not usable in caches + // -CGI access in request + // CGI access makes the page very individual, and therefore not usable in caches if ((isPOST(this.nomalizedURLString)) && (!(this.profile.crawlingQ()))) return "dynamic_post"; if (isCGI(this.nomalizedURLString)) return "dynamic_cgi"; - - // -authorization cases in request - // authorization makes pages very individual, and therefore we cannot use the - // content in the cache - if ((this.requestHeader != null) && (this.requestHeader.containsKey(httpHeader.AUTHORIZATION))) return "personalized"; - - // -ranges in request and response - // we do not cache partial content - if ((this.requestHeader != null) && (this.requestHeader.containsKey(httpHeader.RANGE))) return "partial"; - if ((this.responseHeader != null) && (this.responseHeader.containsKey(httpHeader.CONTENT_RANGE))) return "partial"; - - // -if-modified-since in request - // we do not care about if-modified-since, because this case only occurres if the - // cache file does not exist, and we need as much info as possible for the indexing - - // -cookies in request - // we do not care about cookies, because that would prevent loading more pages - // from one domain once a request resulted in a client-side stored cookie - - // -set-cookie in response - // we do not care about cookies in responses, because that info comes along - // any/many pages from a server and does not express the validity of the page - // in modes of life-time/expiration or individuality - - // -pragma in response - // if we have a pragma non-cache, we don't cache. usually if this is wanted from - // the server, it makes sense - if ((this.responseHeader.containsKey(httpHeader.PRAGMA)) && - (((String) this.responseHeader.get(httpHeader.PRAGMA)).toUpperCase().equals("NO-CACHE"))) return "controlled_no_cache"; - - // -expires in response - // we do not care about expires, because at the time this is called the data is - // obvious valid and that header info is used in the indexing later on - - // -cache-control in response - // the cache-control has many value options. - String cacheControl = (String) this.responseHeader.get(httpHeader.CACHE_CONTROL); - if (cacheControl != null) { + + // -authorization cases in request + // authorization makes pages very individual, and therefore we cannot use the + // content in the cache + if ((this.requestHeader != null) && (this.requestHeader.containsKey(httpHeader.AUTHORIZATION))) return "personalized"; + + // -ranges in request and response + // we do not cache partial content + if ((this.requestHeader != null) && (this.requestHeader.containsKey(httpHeader.RANGE))) return "partial"; + if ((this.responseHeader != null) && (this.responseHeader.containsKey(httpHeader.CONTENT_RANGE))) return "partial"; + + // -if-modified-since in request + // we do not care about if-modified-since, because this case only occurres if the + // cache file does not exist, and we need as much info as possible for the indexing + + // -cookies in request + // we do not care about cookies, because that would prevent loading more pages + // from one domain once a request resulted in a client-side stored cookie + + // -set-cookie in response + // we do not care about cookies in responses, because that info comes along + // any/many pages from a server and does not express the validity of the page + // in modes of life-time/expiration or individuality + + // -pragma in response + // if we have a pragma non-cache, we don't cache. usually if this is wanted from + // the server, it makes sense + if ((this.responseHeader.containsKey(httpHeader.PRAGMA)) && + (((String) this.responseHeader.get(httpHeader.PRAGMA)).toUpperCase().equals("NO-CACHE"))) return "controlled_no_cache"; + + // -expires in response + // we do not care about expires, because at the time this is called the data is + // obvious valid and that header info is used in the indexing later on + + // -cache-control in response + // the cache-control has many value options. + String cacheControl = (String) this.responseHeader.get(httpHeader.CACHE_CONTROL); + if (cacheControl != null) { cacheControl = cacheControl.trim().toUpperCase(); if (cacheControl.startsWith("MAX-AGE=")) { // we need also the load date @@ -680,107 +695,105 @@ public final class plasmaHTCache { return "stale_error_" + e.getMessage() + ")"; } } - } - - - return null; - } + } + return null; + } public boolean shallUseCacheForProxy() { - // decide upon header information if a specific file should be taken from the cache or not - - //System.out.println("SHALL READ CACHE: requestHeader = " + requestHeader.toString() + ", responseHeader = " + responseHeader.toString()); - - // -CGI access in request - // CGI access makes the page very individual, and therefore not usable in caches - if (isPOST(this.nomalizedURLString)) return false; - if (isCGI(this.nomalizedURLString)) return false; - - // -authorization cases in request - if (this.requestHeader.containsKey(httpHeader.AUTHORIZATION)) return false; - - // -ranges in request - // we do not cache partial content - if ((this.requestHeader != null) && (this.requestHeader.containsKey(httpHeader.RANGE))) return false; - - //Date d1, d2; - - // -if-modified-since in request - // The entity has to be transferred only if it has - // been modified since the date given by the If-Modified-Since header. - if (this.requestHeader.containsKey(httpHeader.IF_MODIFIED_SINCE)) { - // checking this makes only sense if the cached response contains - // a Last-Modified field. If the field does not exist, we go the safe way - if (!(this.responseHeader.containsKey(httpHeader.LAST_MODIFIED))) return false; - // parse date + // decide upon header information if a specific file should be taken from the cache or not + + //System.out.println("SHALL READ CACHE: requestHeader = " + requestHeader.toString() + ", responseHeader = " + responseHeader.toString()); + + // -CGI access in request + // CGI access makes the page very individual, and therefore not usable in caches + if (isPOST(this.nomalizedURLString)) return false; + if (isCGI(this.nomalizedURLString)) return false; + + // -authorization cases in request + if (this.requestHeader.containsKey(httpHeader.AUTHORIZATION)) return false; + + // -ranges in request + // we do not cache partial content + if ((this.requestHeader != null) && (this.requestHeader.containsKey(httpHeader.RANGE))) return false; + + //Date d1, d2; + + // -if-modified-since in request + // The entity has to be transferred only if it has + // been modified since the date given by the If-Modified-Since header. + if (this.requestHeader.containsKey(httpHeader.IF_MODIFIED_SINCE)) { + // checking this makes only sense if the cached response contains + // a Last-Modified field. If the field does not exist, we go the safe way + if (!(this.responseHeader.containsKey(httpHeader.LAST_MODIFIED))) return false; + // parse date Date d1, d2; - d2 = this.responseHeader.lastModified(); if (d2 == null) d2 = new Date(serverDate.correctedUTCTime()); - d1 = this.requestHeader.ifModifiedSince(); if (d1 == null) d1 = new Date(serverDate.correctedUTCTime()); - // finally, we shall treat the cache as stale if the modification time is after the if-.. time - if (d2.after(d1)) return false; - } - - boolean isNotPicture = !isPicture(this.responseHeader); - - // -cookies in request - // unfortunately, we should reload in case of a cookie - // but we think that pictures can still be considered as fresh - if ((this.requestHeader.containsKey(httpHeader.COOKIE)) && (isNotPicture)) return false; - - // -set-cookie in cached response - // this is a similar case as for COOKIE. - if ((this.responseHeader.containsKey(httpHeader.SET_COOKIE)) && (isNotPicture)) return false; // too strong - if ((this.responseHeader.containsKey(httpHeader.SET_COOKIE2)) && (isNotPicture)) return false; // too strong - - // -pragma in cached response - // logically, we would not need to care about no-cache pragmas in cached response headers, - // because they cannot exist since they are not written to the cache. - // So this IF should always fail.. - if ((this.responseHeader.containsKey(httpHeader.PRAGMA)) && - (((String) this.responseHeader.get(httpHeader.PRAGMA)).toUpperCase().equals("NO-CACHE"))) return false; - - // calculate often needed values for freshness attributes - Date date = this.responseHeader.date(); - Date expires = this.responseHeader.expires(); - Date lastModified = this.responseHeader.lastModified(); - String cacheControl = (String) this.responseHeader.get(httpHeader.CACHE_CONTROL); - - - // see for documentation also: - // http://www.web-caching.com/cacheability.html - // http://vancouver-webpages.com/CacheNow/ - - // look for freshnes information - // if we don't have any freshnes indication, we treat the file as stale. - // no handle for freshness control: - if ((expires == null) && (cacheControl == null) && (lastModified == null)) return false; - - // -expires in cached response - // the expires value gives us a very easy hint when the cache is stale - if (expires != null) { - //System.out.println("EXPIRES-TEST: expires=" + expires + ", NOW=" + serverDate.correctedGMTDate() + ", url=" + url); - if (expires.before(new Date(serverDate.correctedUTCTime()))) return false; - } - - // -lastModified in cached response - // we can apply a TTL (Time To Live) heuristic here. We call the time delta between the last read - // of the file and the last modified date as the age of the file. If we consider the file as - // middel-aged then, the maximum TTL would be cache-creation plus age. - // This would be a TTL factor of 100% we want no more than 10% TTL, so that a 10 month old cache - // file may only be treated as fresh for one more month, not more. - if (lastModified != null) { - if (date == null) date = new Date(serverDate.correctedUTCTime()); - long age = date.getTime() - lastModified.getTime(); - if (age < 0) return false; - // TTL (Time-To-Live) is age/10 = (d2.getTime() - d1.getTime()) / 10 - // the actual living-time is serverDate.correctedGMTDate().getTime() - d2.getTime() - // therefore the cache is stale, if serverDate.correctedGMTDate().getTime() - d2.getTime() > age/10 - if (serverDate.correctedUTCTime() - date.getTime() > age / 10) return false; - } - - // -cache-control in cached response - // the cache-control has many value options. - if (cacheControl != null) { + d2 = this.responseHeader.lastModified(); if (d2 == null) d2 = new Date(serverDate.correctedUTCTime()); + d1 = this.requestHeader.ifModifiedSince(); if (d1 == null) d1 = new Date(serverDate.correctedUTCTime()); + // finally, we shall treat the cache as stale if the modification time is after the if-.. time + if (d2.after(d1)) return false; + } + + boolean isNotPicture = !isPicture(this.responseHeader); + + // -cookies in request + // unfortunately, we should reload in case of a cookie + // but we think that pictures can still be considered as fresh + if ((this.requestHeader.containsKey(httpHeader.COOKIE)) && (isNotPicture)) return false; + + // -set-cookie in cached response + // this is a similar case as for COOKIE. + if ((this.responseHeader.containsKey(httpHeader.SET_COOKIE)) && (isNotPicture)) return false; // too strong + if ((this.responseHeader.containsKey(httpHeader.SET_COOKIE2)) && (isNotPicture)) return false; // too strong + + // -pragma in cached response + // logically, we would not need to care about no-cache pragmas in cached response headers, + // because they cannot exist since they are not written to the cache. + // So this IF should always fail.. + if ((this.responseHeader.containsKey(httpHeader.PRAGMA)) && + (((String) this.responseHeader.get(httpHeader.PRAGMA)).toUpperCase().equals("NO-CACHE"))) return false; + + // calculate often needed values for freshness attributes + Date date = this.responseHeader.date(); + Date expires = this.responseHeader.expires(); + Date lastModified = this.responseHeader.lastModified(); + String cacheControl = (String) this.responseHeader.get(httpHeader.CACHE_CONTROL); + + + // see for documentation also: + // http://www.web-caching.com/cacheability.html + // http://vancouver-webpages.com/CacheNow/ + + // look for freshnes information + // if we don't have any freshnes indication, we treat the file as stale. + // no handle for freshness control: + if ((expires == null) && (cacheControl == null) && (lastModified == null)) return false; + + // -expires in cached response + // the expires value gives us a very easy hint when the cache is stale + if (expires != null) { + //System.out.println("EXPIRES-TEST: expires=" + expires + ", NOW=" + serverDate.correctedGMTDate() + ", url=" + url); + if (expires.before(new Date(serverDate.correctedUTCTime()))) return false; + } + + // -lastModified in cached response + // we can apply a TTL (Time To Live) heuristic here. We call the time delta between the last read + // of the file and the last modified date as the age of the file. If we consider the file as + // middel-aged then, the maximum TTL would be cache-creation plus age. + // This would be a TTL factor of 100% we want no more than 10% TTL, so that a 10 month old cache + // file may only be treated as fresh for one more month, not more. + if (lastModified != null) { + if (date == null) date = new Date(serverDate.correctedUTCTime()); + long age = date.getTime() - lastModified.getTime(); + if (age < 0) return false; + // TTL (Time-To-Live) is age/10 = (d2.getTime() - d1.getTime()) / 10 + // the actual living-time is serverDate.correctedGMTDate().getTime() - d2.getTime() + // therefore the cache is stale, if serverDate.correctedGMTDate().getTime() - d2.getTime() > age/10 + if (serverDate.correctedUTCTime() - date.getTime() > age / 10) return false; + } + + // -cache-control in cached response + // the cache-control has many value options. + if (cacheControl != null) { cacheControl = cacheControl.trim().toUpperCase(); if (cacheControl.startsWith("PUBLIC")) { // ok, do nothing @@ -801,10 +814,10 @@ public final class plasmaHTCache { return false; } } - } - - return true; - } + } + + return true; + } } diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java index 34af738ff..6eb0099be 100644 --- a/source/de/anomic/plasma/plasmaSwitchboard.java +++ b/source/de/anomic/plasma/plasmaSwitchboard.java @@ -111,13 +111,11 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.TreeSet; import java.util.logging.Level; - import de.anomic.data.messageBoard; import de.anomic.data.wikiBoard; import de.anomic.data.userDB; @@ -139,7 +137,6 @@ import de.anomic.tools.bitfield; import de.anomic.tools.crypt; import de.anomic.yacy.yacyClient; import de.anomic.yacy.yacyCore; -import de.anomic.yacy.yacySearch; import de.anomic.yacy.yacySeed; import de.anomic.yacy.yacyNewsPool; @@ -515,7 +512,15 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser public static plasmaSwitchboard getSwitchboard(){ return sb; } - + + /** + * This method changes the HTCache size.
+ * @param new cache size in mb + */ + public final void setCacheSize(long newCacheSize) { + this.cacheManager.setCacheSize(1048576 * newCacheSize); + } + public boolean onlineCaution() { try { return System.currentTimeMillis() - proxyLastAccess < Integer.parseInt(getConfig("onlineCautionDelay", "30000")); @@ -782,7 +787,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser return hasDoneSomething; } - + /** * With this function the crawling process can be paused */