Author: doogie
Date: Mon Nov 23 03:01:37 2009 New Revision: 883223 URL: http://svn.apache.org/viewvc?rev=883223&view=rev Log: Add another createUtilCache variant that allows for extra properties to be looked upped for setting parameters. Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractCache.java Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java?rev=883223&r1=883222&r2=883223&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java Mon Nov 23 03:01:37 2009 @@ -695,16 +695,22 @@ cache.clear(); } + public static <K, V> UtilCache<K, V> createUtilCache(String cacheName, int maxSize, int maxInMemory, long expireTime, boolean useSoftReference, boolean useFileSystemStore, String... names) { + UtilCache<K, V> cache = new UtilCache<K, V>(cacheName, maxSize, maxInMemory, expireTime, useSoftReference, useFileSystemStore); + cache.setPropertiesParams(names); + return storeCache(cache); + } + public static <K, V> UtilCache<K, V> createUtilCache(String cacheName, int maxSize, int maxInMemory, long expireTime, boolean useSoftReference, boolean useFileSystemStore) { - return storeCache(new UtilCache<K, V>(cacheName, maxSize, maxInMemory, expireTime, useSoftReference, useFileSystemStore)); + return createUtilCache(cacheName, maxSize, maxInMemory, expireTime, useSoftReference, useFileSystemStore, new String[0]); } public static <K,V> UtilCache<K, V> createUtilCache(String cacheName, int maxSize, long expireTime, boolean useSoftReference) { - return createUtilCache(cacheName, maxSize, maxSize, expireTime, useSoftReference, false); + return createUtilCache(cacheName, maxSize, maxSize, expireTime, useSoftReference, false, new String[0]); } public static <K,V> UtilCache<K, V> createUtilCache(String cacheName, int maxSize, long expireTime) { - return createUtilCache(cacheName, maxSize, maxSize, expireTime, false, false); + return createUtilCache(cacheName, maxSize, maxSize, expireTime, false, false, new String[0]); } public static <K,V> UtilCache<K, V> createUtilCache(int maxSize, long expireTime) { Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractCache.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractCache.java?rev=883223&r1=883222&r2=883223&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractCache.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractCache.java Mon Nov 23 03:01:37 2009 @@ -79,9 +79,7 @@ String name = getCacheName(entityName); UtilCache<K, V> cache = UtilCache.findCache(name); if (cache == null) { - cache = UtilCache.createUtilCache(name, 0, 0, true); - String[] names = getCacheNames(entityName); - cache.setPropertiesParams(names); + cache = UtilCache.createUtilCache(name, 0, 0, 0, true, false, getCacheNames(entityName)); } return cache; } |
Free forum by Nabble | Edit this page |