使用ehcache缓存java.util.Map

使用ehcache缓存java.util.Map,java,hibernate,spring,ehcache,Java,Hibernate,Spring,Ehcache,我正在使用EHCache和Hibernate来缓存我的数据库查询结果。 我正在使用google注释(com.googlecode.ehcache.annotations.Cacheable)使DAO方法可缓存 我的问题是,方法中的一个参数是java.util.Map,我不知道如何缓存它 示例代码: import com.googlecode.ehcache.annotations.Cacheable; import com.googlecode.ehcache.annotations.KeyGe

我正在使用EHCache和Hibernate来缓存我的数据库查询结果。 我正在使用google注释(
com.googlecode.ehcache.annotations.Cacheable
)使DAO方法可缓存

我的问题是,方法中的一个参数是
java.util.Map
,我不知道如何缓存它

示例代码:

import com.googlecode.ehcache.annotations.Cacheable;
import com.googlecode.ehcache.annotations.KeyGenerator;
import com.googlecode.ehcache.annotations.PartialCacheKey;
import com.googlecode.ehcache.annotations.Property;
下面是示例方法

@Cacheable(cacheName = "ehcahe", keyGenerator = @KeyGenerator(name = "HashCodeCacheKeyGenerator", properties = @Property(name = "includeMethod", value = "false")))
public Object get( @PartialCacheKey Map map ) {
 //do something
}

有什么帮助吗?

您可以实现自己的
CacheKeyGenerator
,请参阅问题7