svn commit: r637250 - /lenya/trunk/src/java/org/apache/lenya/util/CacheMap.java

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: rfrovarp
Date: Fri Mar 14 13:29:08 2008
New Revision: 637250

URL: http://svn.apache.org/viewvc?rev=637250&view=rev
Log:
The elements in timeToKey weren't being removed as firstKey doesn't do a removal, just a return. This should now work properly.

Modified:
    lenya/trunk/src/java/org/apache/lenya/util/CacheMap.java

Modified: lenya/trunk/src/java/org/apache/lenya/util/CacheMap.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/util/CacheMap.java?rev=637250&r1=637249&r2=637250&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/util/CacheMap.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/util/CacheMap.java Fri Mar 14 13:29:08 2008
@@ -59,7 +59,9 @@
     public Object put(Object key, Object value) {
         
         if (size() == this.capacity) {
-            Object oldestKey = this.timeToKey.get(this.timeToKey.firstKey());
+            Object timeKey = this.timeToKey.firstKey();
+            Object oldestKey = this.timeToKey.get(timeKey);
+            this.timeToKey.remove(timeKey);
             remove(oldestKey);
             if (getLogger().isDebugEnabled()) {
                 getLogger().debug("Clearing cache");
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.