0

java - 春天 - ehCache

我正在使用 spring ehcache 实现 spring context 给了我Cache没有以下方法的对象

 Query query = cache.createQuery();

一些机构可以建议如何createQuery从一个Cache对象。

Spring ehCacheManager bean

<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager"
        p:cacheManager-ref="ehcache" />
    <bean id="ehcache"
        class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"
        p:configLocation="classpath:ehcache.xml" />

@Service
public class CacheServiceImpl implements CacheService {

    @Autowired
    EhCacheCacheManager cacheManager;

    @PostConstruct
private void init() {
    Cache cache = serviceCache = cacheManager.getCache("serviceCache");//Gives me Cache Object CacheObject does not have Query query = cache.createQuery(); method
     }


}
4

1 回答 1

0

找到了

cacheManager.getCacheManager().getEhcache(name)
于 2013-05-22T18:42:50.343 回答