Skip to content

Commit

Permalink
improved web cache speed:
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
orbiter committed Sep 29, 2009
1 parent 2e8b286 commit 5a93807
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions source/de/anomic/kelondro/blob/MapView.java
Expand Up @@ -141,11 +141,11 @@ public void put(String key, final Map<String, String> newMap) throws IOException
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);
Expand Down Expand Up @@ -213,10 +213,7 @@ protected Map<String, String> get(String key, final boolean storeCache) throws I
synchronized (this) {
Map<String, String> 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;
Expand Down

0 comments on commit 5a93807

Please sign in to comment.