diff --git a/framework/base/src/org/ofbiz/base/util/cache/CacheLineTable.java b/framework/base/src/org/ofbiz/base/util/cache/CacheLineTable.java index 04a0302ca7..7410cb7f62 100644 --- a/framework/base/src/org/ofbiz/base/util/cache/CacheLineTable.java +++ b/framework/base/src/org/ofbiz/base/util/cache/CacheLineTable.java @@ -256,6 +256,23 @@ public class CacheLineTable implements Serializable { nullValue = null; } + public synchronized boolean isEmpty() { + if (fileTable != null) { + try { + return fileTable.keys().next() == null; + } catch (IOException e) { + Debug.logError(e, module); + return false; + } + } else { + if (isNullSet) { + return false; + } else { + return memoryTable.isEmpty(); + } + } + } + public synchronized int size() { if (fileTable != null) { return this.keySet().size(); diff --git a/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java b/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java index 37936267ef..bdb161116d 100644 --- a/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java +++ b/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java @@ -213,6 +213,10 @@ public class UtilCache implements Serializable { } } + public boolean isEmpty() { + return cacheLineTable.isEmpty(); + } + /** Puts or loads the passed element into the cache * @param key The key for the element, used to reference it in the hastables and LRU linked list * @param value The value of the element