ALL_CACHE_MANAGERS CacheManager net.sf.ehcache

问题描述 投票:3回答:1

是否有net.sf.ehcache.CacheManager.ALL_CACHE_MANAGERS的替代物>>

    <!-- https://mvnrepository.com/artifact/org.ehcache/ehcache -->
    <dependency>
        <groupId>org.ehcache</groupId>
        <artifactId>ehcache</artifactId>
        <version>3.8.1</version>
    </dependency>

这是我需要修改以使用版本3.8.1的代码:

import org.ehcache.CacheManager;
    .
    .
    .
        List list = CacheManager.ALL_CACHE_MANAGERS;

        for (int i = 0, n = list.size(); i < n; i++) {
            CacheManager cm = (CacheManager) list.get(i);
            log.debug("CacheManager: " + cm.getName());

            if (cm.getName().equals(CACHE_MANAGER_NAME)) {
                log.debug("CM " + CACHE_MANAGER_NAME + " existed. Destroying it.");
                cm.shutdown();
            }
        }

ehcache 3.8.1中是否有这样做的方法?

是否在 ... []]中>替换了net.sf.ehcache.CacheManager.ALL_CACHE_MANAGERS。

ehcache ehcache-3
1个回答
0
投票

[看起来ALL_CACHE_MANAGERS被ehcache 3.8.1中的org.ehcache.clustered.operations命令ListCacheManagers代替。

可以如下使用。

OperationsTool.main(...)

© www.soinside.com 2019 - 2024. All rights reserved.