You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by rm...@apache.org on 2014/05/12 19:22:32 UTC

svn commit: r1594032 - in /commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache: JCSCache.java JCSKey.java

Author: rmannibucau
Date: Mon May 12 17:22:32 2014
New Revision: 1594032

URL: http://svn.apache.org/r1594032
Log:
cleanup of some no more needed methods since we rely on jcs core + caching hashcode of jcache key wrappers

Modified:
    commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/JCSCache.java
    commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/JCSKey.java

Modified: commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/JCSCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/JCSCache.java?rev=1594032&r1=1594031&r2=1594032&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/JCSCache.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/JCSCache.java Mon May 12 17:22:32 2014
@@ -217,7 +217,6 @@ public class JCSCache<K, V> implements C
             if (duration == null || !duration.isZero())
             {
                 final JCSKey<K> jcsKey = new JCSKey<K>(key);
-                jcsKey.access(Times.now(false));
                 delegate.put(jcsKey, new JCSElement<V>(v, duration));
             }
         }
@@ -313,7 +312,6 @@ public class JCSCache<K, V> implements C
         {
             writer.write(new JCSEntry<K, V>(key, value));
             final JCSKey<K> jcsKey = storeByValue ? new JCSKey<K>(copy(serializer, manager.getClassLoader(), key)) : cacheKey;
-            jcsKey.access(start);
             delegate.put(jcsKey, element);
             for (final JCSListener<K, V> listener : listeners.values())
             {
@@ -475,7 +473,6 @@ public class JCSCache<K, V> implements C
 
         if (updateAcess && elt != null)
         {
-            key.access(getStart);
             elt.update(expiryPolicy.getExpiryForAccess());
             if (elt.isExpired())
             {

Modified: commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/JCSKey.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/JCSKey.java?rev=1594032&r1=1594031&r2=1594032&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/JCSKey.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-jcache/src/main/java/org/apache/commons/jcs/jcache/JCSKey.java Mon May 12 17:22:32 2014
@@ -23,20 +23,11 @@ import java.io.Serializable;
 public class JCSKey<K> implements Serializable
 {
     private final K key;
-    private volatile long lastAccess = 0;
+    private volatile int hashCode = 0;
 
     public JCSKey(final K key) {
         this.key = key;
-    }
-
-    public void access(final long time)
-    {
-        lastAccess = time;
-    }
-
-    public long lastAccess()
-    {
-        return lastAccess;
+        this.hashCode = this.key.hashCode();
     }
 
     public K getKey()
@@ -57,6 +48,6 @@ public class JCSKey<K> implements Serial
     @Override
     public int hashCode()
     {
-        return key.hashCode();
+        return hashCode;
     }
 }