为什么不建议使用org.hibernate.cache.Cache?

Basit Anwer:

不但不推荐使用此功能,而且不推荐使用org.hibernate.cache.Cache.CacheProvider。

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

锡洛:

JavaDoc的解释是:

缓存的传统方法(现已弃用)由CacheProvider和Cache接口以及CacheConcurrencyStrategy接口以及所有这些接口的各种实现定义。在该方案中,CacheProvider定义了如何针对特定的基础缓存库配置和执行生命周期操作。它还定义了如何构建缓存实例,进而定义了如何访问基础缓存实例的“区域”。对于实体和集合数据缓存区域,CacheConcurrencyStrategy打包了对那些缓存区域的访问,以应用事务/并发访问语义。

改进的方法基于RegionFactory,各种Region专业知识和两个访问策略协定(EntityRegionAccessStrategy和CollectionRegionAccessStrategy)。

总结起来,您应该使用一个经过改进的新API。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Hibernate Cache批注

在使用Hibernate 4时,我对`org.hibernate.cache.EhCacheProvider`需要什么依赖?

java.lang.NoClassDefFoundError:org / hibernate / cache / EntityRegion配置EHCache

使用Hibernate的二级缓存找不到类[org.hibernate.cache.EhCacheProvider]

org.hibernate.cache.CacheException:在 HIBERNATE 中不支持即时创建 JCache 缓存对象

为什么我们必须在 Hibernate 中使用 @Cacheable 和 @Cache 来实现二级缓存?

为什么使用apt.Cache而不是apt.cache.Cache()创建对象

什么是ndisc_cache?

org.hibernate.cache.CacheException:不支持的访问类型[读写]

java.lang.NoClassDefFoundError:休眠5.3.1中的org / hibernate / cache / spi / TransactionalDataRegion

Hibernate hbm xml中的cache元素内部的region属性做什么?

为什么.gitignore不忽略.sass-cache?

什么是git-cache,什么存储在git-cache中

什么是.phpunit.result.cache

什么是 icon-theme.cache?

Hibernate中的Cache并发中的只读vs NonRestrict读写

将Spring Cache与Hazelcast Near Cache一起使用

正确使用Cache2k中的cache.putIfAbsent()

使用“ Distributed Cache”和“ Options”选项来处理“ Cache Miss”

使用SentenceTransformer在... \。cache \中的FileNotFoundError

使用tmpfs挂载〜/ .cache目录

正确使用.cache()和.unpersist()

为什么在使用常规方法时functools.lru_cache不缓存__call__

什么使用和填充 ~/.cache/kioexec/krun/?

为什么Cache.asMap()与Cache.size()不一致?

mime.cache文件的目的是什么?

pytest-cache背后的想法是什么?

使用参数运行rails dev:cache

在Spring Cache中使用多个缓存实现