Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

calculating and showing the number of files and the average size of a file in the HTCACHE in ConfigHTCache_p.html

Michael Peter Christen87a956e8813a
diff --git a/htroot/ConfigHTCache_p.html b/htroot/ConfigHTCache_p.html
index ae8c851ce..890ae9845 100644
--- a/htroot/ConfigHTCache_p.html
+++ b/htroot/ConfigHTCache_p.html
@@ -19,7 +19,7 @@
<dt><label for="HTCachePath">The path where the cache is stored</label></dt>
<dd><input name="HTCachePath" id="HTCachePath" type="text" size="20" maxlength="300" value="#[HTCachePath]#" /></dd>
<dt><label for="actualCacheSize">The current size of the cache</label></dt>
- <dd><span id="actualCacheSize">#[actualCacheSize]# MB</span></dd>
+ <dd><span id="actualCacheSize">#[actualCacheSize]# MB for #[actualCacheDocCount]# files, #[docSizeAverage]# KB / file in average </span></dd>
<dt><label for="maxCacheSize">The maximum size of the cache</label></dt>
<dd><input name="maxCacheSize" id="maxCacheSize" type="text" size="8" maxlength="24" value="#[maxCacheSize]#" /> MB</dd>
<dt>&nbsp;</dt>
diff --git a/htroot/ConfigHTCache_p.java b/htroot/ConfigHTCache_p.java
index 73141e65a..48d4df623 100644
--- a/htroot/ConfigHTCache_p.java
+++ b/htroot/ConfigHTCache_p.java
@@ -77,7 +77,9 @@ public class ConfigHTCache_p {
}
prop.put("HTCachePath", env.getConfig(SwitchboardConstants.HTCACHE_PATH, SwitchboardConstants.HTCACHE_PATH_DEFAULT));
- prop.put("actualCacheSize", (Cache.getActualCacheSize() / 1024 / 1024));
+ prop.put("actualCacheSize", Cache.getActualCacheSize() / 1024 / 1024);
+ prop.put("actualCacheDocCount", Cache.getActualCacheDocCount());
+ prop.put("docSizeAverage", Cache.getActualCacheSize() / Cache.getActualCacheDocCount() / 1024);
prop.put("maxCacheSize", env.getConfigLong(SwitchboardConstants.PROXY_CACHE_SIZE, 64));
// return rewrite properties
return prop;
diff --git a/source/net/yacy/crawler/data/Cache.java b/source/net/yacy/crawler/data/Cache.java
index f1d72354f..9973f08a0 100644
--- a/source/net/yacy/crawler/data/Cache.java
+++ b/source/net/yacy/crawler/data/Cache.java
@@ -182,6 +182,14 @@ public final class Cache {
public static long getActualCacheSize() {
return fileDBunbuffered.length();
}
+
+ /**
+ * get the current actual cache size
+ * @return
+ */
+ public static long getActualCacheDocCount() {
+ return fileDBunbuffered.size();
+ }
/**
* close the databases