From 5a938077817330c887d76e66b77516be0a5f8797 Mon Sep 17 00:00:00 2001 From: orbiter Date: Tue, 29 Sep 2009 08:41:05 +0000 Subject: [PATCH] improved web cache speed: - removed one computation out of a synchronization - removed one not necessary has() call git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6358 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/kelondro/blob/MapView.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/source/de/anomic/kelondro/blob/MapView.java b/source/de/anomic/kelondro/blob/MapView.java index 1a4d59d45..9c69e127f 100644 --- a/source/de/anomic/kelondro/blob/MapView.java +++ b/source/de/anomic/kelondro/blob/MapView.java @@ -141,11 +141,11 @@ public class MapView { assert newMap != null; key = normalizeKey(key); assert blob != null; + String s = map2string(newMap, "W" + DateFormatter.formatShortSecond() + " "); + assert s != null; synchronized (this) { // write entry - String s = map2string(newMap, "W" + DateFormatter.formatShortSecond() + " "); - assert s != null; - blob.put(key.getBytes("UTF-8"), s.getBytes("UTF-8")); + blob.put(key.getBytes("UTF-8"), s.getBytes("UTF-8")); // write map to cache cache.put(key, newMap); @@ -213,10 +213,7 @@ public class MapView { synchronized (this) { Map map = cache.get(key); if (map != null) return map; - - // load map - if (!(blob.has(key.getBytes()))) return null; - + // read object final byte[] b = blob.get(key.getBytes()); if (b == null) return null;