提交 54f82cd5 编写于 作者: J Juergen Hoeller 提交者: Chris Beams

Polish caching components

上级 7ea85a95
/**
* Annotations and supporting classes for declarative cache management.
* Hooked into Spring's caching interception infrastructure
* via {@link org.springframework.cache.interceptor.CacheOperationSource
* CacheOperationSource} implementation.
* Hooked into Spring's cache interception infrastructure via
* {@link org.springframework.cache.interceptor.CacheOperationSource}.
*/
package org.springframework.cache.annotation;
......@@ -16,13 +16,13 @@
package org.springframework.cache.concurrent;
import org.springframework.cache.Cache;
import org.springframework.cache.support.SimpleValueWrapper;
import java.io.Serializable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.springframework.cache.Cache;
import org.springframework.cache.support.SimpleValueWrapper;
/**
* Simple {@link Cache} implementation based on the core JDK
* {@code java.util.concurrent} package.
......@@ -62,6 +62,7 @@ public class ConcurrentMapCache implements Cache {
/**
* Create a new ConcurrentMapCache with the specified name.
* @param name the name of the cache
* @param allowNullValues whether to accept and convert null values for this cache
*/
public ConcurrentMapCache(String name, boolean allowNullValues) {
this(name, new ConcurrentHashMap<Object, Object>(), allowNullValues);
......
/**
* Implementation package for {@code java.util.concurrent} based caches.
* Provides a {@link org.springframework.cache.CacheManager CacheManager}
* and {@link org.springframework.cache.Cache Cache} implementation for
* use in a Spring context.
* use in a Spring context, using a JDK based thread pool at runtime.
*/
package org.springframework.cache.concurrent;
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -57,10 +57,6 @@ public class EhCacheCache implements Cache {
return this.cache;
}
public void clear() {
this.cache.removeAll();
}
public ValueWrapper get(Object key) {
Element element = this.cache.get(key);
return (element != null ? new SimpleValueWrapper(element.getObjectValue()) : null);
......@@ -74,4 +70,8 @@ public class EhCacheCache implements Cache {
this.cache.remove(key);
}
public void clear() {
this.cache.removeAll();
}
}
......@@ -39,18 +39,17 @@ public class EhCacheCacheManager extends AbstractCacheManager {
/**
* Returns the backing EhCache {@link net.sf.ehcache.CacheManager}.
* @return the backing EhCache {@link net.sf.ehcache.CacheManager}.
* Set the backing EhCache {@link net.sf.ehcache.CacheManager}.
*/
public net.sf.ehcache.CacheManager getCacheManager() {
return cacheManager;
public void setCacheManager(net.sf.ehcache.CacheManager cacheManager) {
this.cacheManager = cacheManager;
}
/**
* Sets the backing EhCache {@link net.sf.ehcache.CacheManager}.
* Return the backing EhCache {@link net.sf.ehcache.CacheManager}.
*/
public void setCacheManager(net.sf.ehcache.CacheManager cacheManager) {
this.cacheManager = cacheManager;
public net.sf.ehcache.CacheManager getCacheManager() {
return this.cacheManager;
}
......@@ -83,4 +82,5 @@ public class EhCacheCacheManager extends AbstractCacheManager {
}
return cache;
}
}
\ No newline at end of file
}
/**
*
* Support classes for the open source cache
* <a href="http://ehcache.sourceforge.net">Ehcache</a>,
* allowing to set up an EHCache CacheManager and Caches
* <a href="http://ehcache.sourceforge.net">EhCache</a>,
* allowing to set up an EhCache CacheManager and Caches
* as beans in a Spring context.
*
*/
package org.springframework.cache.ehcache;
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册