gpt4 book ai didi

java - 为什么不推荐使用 org.hibernate.cache.Cache?

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:19:19 24 4
gpt4 key购买 nike

不仅如此,org.hibernate.cache.Cache.CacheProvider 也被弃用了。

如果这些是那么我们应该如何创建我们自己的自定义缓存解决方案?替代方法?

最佳答案

JavaDoc解释一下:

The legacy (and now deprecated) approach to caching is defined by the CacheProvider and Cache interfaces as well as the CacheConcurrencyStrategy interface along with the various implementations of all these interfaces. In that scheme, a CacheProvider defined how to configure and perform lifecycle operations in regards to a particular underlying caching library; it also defined how to build Cache instances which in turn defined how to access the "regions" of the underlying cache instance. For entity and collection data cache regions, CacheConcurrencyStrategy wrapped access to those cache regions to apply transactional/concurrent access semantics.

The improved approach is based on RegionFactory, the various Region specializations and the two access strategies contracts (EntityRegionAccessStrategy and CollectionRegionAccessStrategy).

总而言之,您应该使用一个经过改进的新 API。

关于java - 为什么不推荐使用 org.hibernate.cache.Cache?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4332586/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com