【问题标题】:spring 4.1.7 and clustered ehcache configuration possible?spring 4.1.7 和集群 ehcache 配置可能吗?
【发布时间】:2015-07-21 10:42:43
【问题描述】:

我的 ehcache 配置是这样开始的:

<ehcache   maxBytesLocalHeap="200M" updateCheck="false">

在遇到“maxEntriesLocalHeap 与缓存管理器上设置的 maxBytesLocalHeap 不兼容”之类的错误后,我查看了 spring-context-support 的来源:

@SuppressWarnings("deprecation")
    public EhCacheFactoryBean() {
        setMaxEntriesLocalHeap(10000);
        setMaxElementsOnDisk(10000000);
        setTimeToLiveSeconds(120);
        setTimeToIdleSeconds(120);
    }

对 setMaxElementsOnDisk 的调用是这样注释的:

void net.sf.ehcache.config.CacheConfiguration.setMaxElementsOnDisk(int maxElementsOnDisk)



Deprecated. use setMaxEntriesLocalDisk(long) for unclustered caches and setMaxEntriesInCache(long) for clustered caches.

Sets the maximum number elements on Disk. 0 means unlimited. 

This property can be modified dynamically while the cache is operating.

Parameters:
maxElementsOnDisk the maximum number of Elements to allow on the disk. 0 means unlimited.

这是否意味着使用 spring 4.1.7 及其依赖项 ehcache 2.9.1 集群缓存是不可能使用 springs EhCacheFactoryBean 的?

最好的问候, 卡斯滕

【问题讨论】:

    标签: java spring ehcache


    【解决方案1】:

    抱歉,我看不到代码/文档 sn-ps 与您的结论之间的链接。能详细点吗?

    有一件事是,Spring 的默认缓存创建似乎与您想要在 CacheManager 级别执行的操作相冲突。但是如果你不使用默认缓存,你应该没有问题。

    【讨论】:

      【解决方案2】:

      CacheManager 和缓存必须使用相同的配置参数 maxBytesLocalHeap 或 maxEntriesLocalHeap,MaxElements* 已弃用

      【讨论】:

        猜你喜欢
        • 2014-06-20
        • 1970-01-01
        • 2015-03-04
        • 1970-01-01
        • 2017-04-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多