本文介绍了Ehcache从2.6迁移到3.00的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Project的Ehcache从2.6版本升级到3.0版本.

I am trying to upgrade Ehcache for my Project from 2.6 to 3.0 version.

net.sf.ehcache.Element和CacheExceptionHandler的任何替代.

Any replacement for net.sf.ehcache.Element and CacheExceptionHandler.

缺少有关Ehcache 3的文档,谁能提供一些有关将Ehacahe升级到版本3的提示.

Less documentation on Ehcache 3, Can anyone give some tips for upgrading Ehacahe to version 3.

推荐答案

Ehcache 3是从设计上对API的重大改进,因此与Ehcache 2.x确实存在很大差异.

Ehcache 3 is by design a major rework of the APIs so there are indeed large differences with Ehcache 2.x.

  • net.sf.ehcache.Element已被完全删除,org.ehcache.Cache API现在更接近(但不完全相同)与java.util.concurrent.ConcurrentMap.这意味着您只需put(K key, V value)V get(K key)-不需要包装对象.
    • 其结果是您不能再设置每个映射到期时间.但是,可以配置自定义org.ehcache.expiry.Expiry,该自定义org.ehcache.expiry.Expiry可以具有映射的特定答案.
    • net.sf.ehcache.Element has been completely removed, the org.ehcache.Cache API is now closer (but not identical) to a java.util.concurrent.ConcurrentMap. This means you simply put(K key, V value) and V get(K key) - no need for a wrapper object.
      • A consequence of that is that you can no longer set a per mapping expiration. However, a custom org.ehcache.expiry.Expiry can be configured which can have mapping specific answers.

      对于有关从一个迁移到另一个的主题的更完整的文档,确实是需要做的事情.

      As for a more complete documentation on the topic of migrating from one to the other, that is indeed something that still needs to be done.

      这篇关于Ehcache从2.6迁移到3.00的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 16:50