1 24 package org.riotfamily.website.cache; 25 26 import org.riotfamily.cachius.Cache; 27 import org.riotfamily.riot.dao.RiotDao; 28 29 33 public final class CacheInvalidationUtils { 34 35 private CacheInvalidationUtils() { 36 } 37 38 public static void invalidate(Cache cache, Class clazz) { 39 if (cache != null) { 40 cache.invalidateTaggedItems(clazz.getName()); 41 } 42 } 43 44 public static void invalidate(Cache cache, Class clazz, Object objectId) { 45 if (cache != null) { 46 cache.invalidateTaggedItems(clazz.getName()); 47 cache.invalidateTaggedItems(clazz.getName() + '#' + objectId); 48 } 49 } 50 51 public static void invalidate(Cache cache, RiotDao dao) { 52 invalidate(cache, dao.getEntityClass()); 53 } 54 55 public static void invalidate(Cache cache, RiotDao dao, Object object) { 56 invalidate(cache, dao.getEntityClass(), dao.getObjectId(object)); 57 } 58 59 } 60 | Popular Tags |