cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1412507 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/cache/EhCacheQueryCache.java
Date Thu, 22 Nov 2012 11:14:35 GMT
Author: aadamchik
Date: Thu Nov 22 11:14:34 2012
New Revision: 1412507

URL: http://svn.apache.org/viewvc?rev=1412507&view=rev
Log:
cleanup

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/cache/EhCacheQueryCache.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/cache/EhCacheQueryCache.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/cache/EhCacheQueryCache.java?rev=1412507&r1=1412506&r2=1412507&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/cache/EhCacheQueryCache.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/cache/EhCacheQueryCache.java
Thu Nov 22 11:14:34 2012
@@ -30,42 +30,41 @@ import org.apache.cayenne.query.QueryMet
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-
 public class EhCacheQueryCache implements QueryCache {
-    
+
     /**
      * Default cache group name.
      */
     static final String DEFAULT_CACHE_NAME = "cayenne.default.cachegroup";
-    
+
     private static Log logger = LogFactory.getLog(EhCacheQueryCache.class);
-    
+
     protected CacheManager cacheManager;
-    
+
     public EhCacheQueryCache() {
         cacheManager = new CacheManager();
         init();
     }
-    
+
     public EhCacheQueryCache(String configFile) {
         cacheManager = new CacheManager(configFile);
         init();
     }
-    
+
     public EhCacheQueryCache(CacheManager cacheManager) {
         if (cacheManager != null) {
             this.cacheManager = cacheManager;
             init();
-        }
-        else {
+        } else {
             throw new CayenneRuntimeException("CacheManager cannot be null.");
         }
     }
-    
+
     private void init() {
         cacheManager.addCacheIfAbsent(DEFAULT_CACHE_NAME);
     }
 
+    @SuppressWarnings("rawtypes")
     public List get(QueryMetadata metadata) {
         String key = metadata.getCacheKey();
         if (key == null) {
@@ -83,6 +82,7 @@ public class EhCacheQueryCache implement
         return result != null ? (List) result.getObjectValue() : null;
     }
 
+    @SuppressWarnings("rawtypes")
     public List get(QueryMetadata metadata, QueryCacheEntryFactory factory) {
 
         String key = metadata.getCacheKey();
@@ -137,8 +137,11 @@ public class EhCacheQueryCache implement
             cache.releaseWriteLockOnKey(key);
         }
     }
-    
-    private String cacheName(String key, String... cacheGroups) {
+
+    /**
+     * @since 3.2
+     */
+    protected String cacheName(String key, String... cacheGroups) {
         if (cacheGroups != null && cacheGroups.length > 0) {
 
             if (cacheGroups.length > 1) {
@@ -152,12 +155,13 @@ public class EhCacheQueryCache implement
         return DEFAULT_CACHE_NAME;
     }
 
+    @SuppressWarnings("rawtypes")
     public void put(QueryMetadata metadata, List results) {
         String key = metadata.getCacheKey();
         if (key != null) {
             String cacheName = cacheName(key, metadata.getCacheGroups());
             Ehcache cache = cacheManager.addCacheIfAbsent(cacheName);
-            cache.put(new Element(key,results));
+            cache.put(new Element(key, results));
         }
     }
 
@@ -166,7 +170,7 @@ public class EhCacheQueryCache implement
             for (String cache : cacheManager.getCacheNames()) {
                 cacheManager.getCache(cache).remove(key);
             }
-        }   
+        }
     }
 
     public void removeGroup(String groupKey) {
@@ -187,11 +191,16 @@ public class EhCacheQueryCache implement
 
     /**
      * Returns default cache group.
+     * 
+     * @deprecated since 3.2 - this method is no longer in use. If you are
+     *             overriding it, override {@link #cacheName(String, String...)}
+     *             instead.
      */
+    @Deprecated
     public Ehcache getDefaultCache() {
         return cacheManager.getCache(DEFAULT_CACHE_NAME);
     }
-    
+
     /**
      * Shuts down EhCache CacheManager
      */



Mime
View raw message