将LoadCache与CacheManager一起使用

时间:2017-03-30 08:33:36

标签: java spring caching guava cachemanager

我使用下一个用于我的自定义缓存管理器:

SimpleCacheManager cacheManager = new SimpleCacheManager();
GuavaCache myCache = new GuavaCache("telescope", CacheBuilder.newBuilder()
                .expireAfterWrite(5, TimeUnit.MINUTES).build());
cacheManager.setCaches(Arrays.asList(myCache));
return cacheManager;

现在我想使用LoadingCache,因为我需要方法refreshAfterWrite(5, TimeUnit.MINUTES)而不是expireAfterWrite(5, TimeUnit.MINUTES)

我无法将LoadingCache放到GuavaCache中,然后将此GuavaCache设置为SimpleCacheManager。

我需要使用哪些实现?

0 个答案:

没有答案
相关问题