From 863864fcce3bcdba5e9783adf9d23863f50ce202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Galder=20Zamarre=C3=B1o?= Date: Mon, 20 Dec 2010 11:00:45 +0100 Subject: [PATCH] HHH-5793 - Query and timestamp caches to use cluster cache loader Make evict put calls skip the cache loader since previous value is not needed. --- .../org/hibernate/cache/infinispan/util/CacheHelper.java | 4 ++-- .../org/hibernate/cache/infinispan/util/FlagAdapter.java | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/CacheHelper.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/CacheHelper.java index 984f6c63cc..923c2b06a2 100644 --- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/CacheHelper.java +++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/CacheHelper.java @@ -50,12 +50,12 @@ public class CacheHelper { public static void initInternalEvict(CacheAdapter cacheAdapter, AddressAdapter member) { EvictAll eKey = new EvictAll(member == null ? NoAddress.INSTANCE : member); - cacheAdapter.withFlags(FlagAdapter.CACHE_MODE_LOCAL).put(eKey, Internal.INIT); + cacheAdapter.withFlags(FlagAdapter.CACHE_MODE_LOCAL, FlagAdapter.SKIP_CACHE_LOAD).put(eKey, Internal.INIT); } public static void sendEvictAllNotification(CacheAdapter cacheAdapter, AddressAdapter member) { EvictAll eKey = new EvictAll(member == null ? NoAddress.INSTANCE : member); - cacheAdapter.put(eKey, Internal.EVICT); + cacheAdapter.withFlags(FlagAdapter.SKIP_CACHE_LOAD).put(eKey, Internal.EVICT); } public static boolean isEvictAllNotification(Object key) { diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/FlagAdapter.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/FlagAdapter.java index f4f7a3a308..b4d329bf0f 100644 --- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/FlagAdapter.java +++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/FlagAdapter.java @@ -36,7 +36,8 @@ public enum FlagAdapter { CACHE_MODE_LOCAL, FORCE_ASYNCHRONOUS, FORCE_SYNCHRONOUS, - SKIP_CACHE_STORE; + SKIP_CACHE_STORE, + SKIP_CACHE_LOAD; Flag toFlag() { switch(this) { @@ -50,6 +51,8 @@ public enum FlagAdapter { return Flag.FORCE_SYNCHRONOUS; case SKIP_CACHE_STORE: return Flag.SKIP_CACHE_STORE; + case SKIP_CACHE_LOAD: + return Flag.SKIP_CACHE_LOAD; default: throw new CacheException("Unmatched Infinispan flag " + this); }