diff --git a/gemini/src/main/java/com/techempower/cache/EntityStore.java b/gemini/src/main/java/com/techempower/cache/EntityStore.java index 6aab9661..ab1f1982 100755 --- a/gemini/src/main/java/com/techempower/cache/EntityStore.java +++ b/gemini/src/main/java/com/techempower/cache/EntityStore.java @@ -1029,14 +1029,24 @@ public T get(Class type, String methodName, Object v * * @param id the id of the object */ - public void refresh(Class type, long id) + public void refresh(Class type, long... ids) { - getGroupSafe(type).refresh(id); + getGroupSafe(type).refresh(ids); final MethodValueCache methodValueCache = methodValueCaches.get(type); if (methodValueCache != null) { - methodValueCache.update(id); + for (long id : ids) { + methodValueCache.update(id); + } + } + + // Notify the listeners. + final CacheListener[] toNotify = listeners; + for (CacheListener listener : toNotify) { + for (long id : ids) { + listener.cacheObjectExpired(type, id); + } } } @@ -1714,6 +1724,14 @@ public void removeAll(Collection objects) methodValueCache.delete(id); } } + + // Notify the listeners. + final CacheListener[] toNotify = listeners; + for (CacheListener listener : toNotify) { + for (long id : collection) { + listener.removeFromCache(type, id); + } + } } }