Java Code Examples for org.springframework.cache.Cache#getName()

The following examples show how to use org.springframework.cache.Cache#getName() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
protected <O> void manage(String key, O object, Action operation) {
    if (null == object) {
        return;
    }
    Cache cache = this.getCache();
    List<String> codes = (List<String>) this.get(cache, this.getCodesCacheKey(), List.class);
    if (Action.ADD.equals(operation)) {
        if (!codes.contains(key)) {
            codes.add(key);
            cache.put(this.getCodesCacheKey(), codes);
        }
        cache.put(this.getCacheKeyPrefix() + key, object);
    } else if (Action.UPDATE.equals(operation)) {
        if (!codes.contains(key)) {
            throw new CacheItemNotFoundException(key, cache.getName());
        }
        cache.put(this.getCacheKeyPrefix() + key, object);
    } else if (Action.DELETE.equals(operation)) {
        codes.remove(key);
        cache.evict(this.getCacheKeyPrefix() + key);
        cache.put(this.getCodesCacheKey(), codes);
    }
}
 
Example 2
/**
 * Dynamically register an additional Cache with this manager.
 * @param cache the Cache to register
 * @deprecated as of Spring 4.3, in favor of {@link #getMissingCache(String)}
 */
@Deprecated
protected final void addCache(Cache cache) {
	String name = cache.getName();
	synchronized (this.cacheMap) {
		if (this.cacheMap.put(name, decorateCache(cache)) == null) {
			updateCacheNames(name);
		}
	}
}
 
Example 3
/**
 * Dynamically register an additional Cache with this manager.
 * @param cache the Cache to register
 * @deprecated as of Spring 4.3, in favor of {@link #getMissingCache(String)}
 */
@Deprecated
protected final void addCache(Cache cache) {
	String name = cache.getName();
	synchronized (this.cacheMap) {
		if (this.cacheMap.put(name, decorateCache(cache)) == null) {
			updateCacheNames(name);
		}
	}
}
 
Example 4
/**
 * Dynamically register an additional Cache with this manager.
 * @param cache the Cache to register
 * @deprecated as of Spring 4.3, in favor of {@link #getMissingCache(String)}
 */
@Deprecated
protected final void addCache(Cache cache) {
	String name = cache.getName();
	synchronized (this.cacheMap) {
		if (this.cacheMap.put(name, decorateCache(cache)) == null) {
			updateCacheNames(name);
		}
	}
}
 
Example 5
/**
 * Dynamically register an additional Cache with this manager.
 * @param cache the Cache to register
 */
protected final void addCache(Cache cache) {
	String name = cache.getName();
	synchronized (this.cacheMap) {
		if (this.cacheMap.put(name, decorateCache(cache)) == null) {
			updateCacheNames(name);
		}
	}
}
 
Example 6
@SuppressWarnings("unchecked")
@Override
public void init(Cache cache, Map<String, String> args) {
    String name = cache.getName();
    if(!DockerService.CACHE_CONTAINER_DETAILS.equals(name)) {
        return;
    }
    Consumer<DockerLogEvent> listener = this.listeners.computeIfAbsent(name, (n) -> this.makeInvalidator(cache));
    logEvents.subscribe(listener);
}
 
Example 7
private MgmtSystemCache cacheRest(final Cache cache) {
    final Object nativeCache = cache.getNativeCache();
    if (nativeCache instanceof com.google.common.cache.Cache) {
        return guavaCache(cache, nativeCache);
    } else {
        return new MgmtSystemCache(cache.getName(), Collections.emptyList());
    }
}