List of usage examples for org.springframework.cache Cache clear
void clear();
From source file:org.springframework.cache.interceptor.YJFCacheAspectSupport.java
private void inspectCacheEvicts(Collection<CacheOperationContext> evictions, boolean beforeInvocation) { if (!evictions.isEmpty()) { boolean log = logger.isTraceEnabled(); for (CacheOperationContext context : evictions) { CacheEvictOperation evictOp = (CacheEvictOperation) context.operation; if (beforeInvocation == evictOp.isBeforeInvocation()) { if (context.isConditionPassing()) { // for each cache // lazy key initialization Object key = null; for (Cache cache : context.getCaches()) { // cache-wide flush if (evictOp.isCacheWide()) { cache.clear(); if (log) { logger.trace("Invalidating entire cache for operation " + evictOp + " on method " + context.method); }// www .ja va2 s . c o m } else { // check key if (key == null) { key = context.generateKey(); } if (log) { logger.trace("Invalidating cache key " + key + " for operation " + evictOp + " on method " + context.method); } cache.evict(key); } } } else { if (log) { logger.trace("Cache condition failed on method " + context.method + " for operation " + context.operation); } } } } } }
From source file:org.yes.cart.web.service.ws.impl.BackdoorServiceImpl.java
private void safeFlushCache(final Cache cache) { if (cache != null) { cache.clear(); } }