使用增值而非复制时的 JBoss TreeCache 与 PojoCache
我们正在设置一个 Jboss 集群,并且正在构建一个基于 Jboss 缓存的自己的分布式缓存解决方案(在我们的示例中,不能将其用作 ORM 层的二级缓存)。我们希望使用失效而不是复制作为缓存模式。据我所知,经过(非常)少量的测试后,这两种解决方案似乎都有效,对象被放入缓存中,并且当对象在任何服务器上更新时,对象似乎被逐出。 这让我相信只有在使用复制时才需要带有 AOP 检测的 PojoCache,这样您就可以只复制更新的字段值而不是整个对象。我在这里是否正确,或者在我们的场景中使用 PojoCache 相对于 TreeCache 是否还有其他优势?如果 PojoCache 有优势,那么我们是否仍然需要 AOP 检测并使用 @PojoCacheable 注释我们的实体(是的,我们正在使用 JBCache 1.4.1),因为我们没有使用复制?
问候 乔纳斯·海尼森
We are setting up a Jboss cluster and we are building an own distributed cache solution built upon Jboss cache (Cant use it as 2nd level cache to ORM layer in our case). We want to use invalidation and not replication as cache mode. As far as i can see after (very) little testing both solutions seem to work, objects are put into the cache and objects seem to be evicted when they are updated on any of the servers.
This leads me to believe that PojoCache with AOP instrumentation is only needed when using replication so that you can replicate only updated field values and not whole objects. Am I correct here or are there any other advantages with using PojoCache over TreeCache in our scenario? And if PojoCache have advantages, do we still need AOP instrumentation and to annotate our entities with @PojoCacheable (yes, we are using JBCache 1.4.1) since we are not using relication?
Regards
Jonas Heineson
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
PoJoCache 通过 AOP 能够:
TreeCache(普通)不需要 AOP,但因此无法复制单个字段或检测已更改的内容,因此您需要自己触发复制。
如果你不复制,这些点可能是无关紧要的。
IIrc,您不需要 Pojo 缓存的 @PojocaCacheable 注释 - 没有它,您需要以不同的方式指定要增强的类。
我的感觉是,如果你不进行复制,普通的 TreeCache 就足够了。
PoJoCache has the ability through AOP to:
TreeCache (plain) does not need AOP, but can thus not replicate individual fields or detect what has changed so that you need to trigger replication yourself.
If you don't replicate, those points are probably irrelevant.
IIrc, you don't need the @PojocaCacheable annotation for Pojo cache - without it, you need to specify the classes to be enhanced in a different way.
I have the feeling that if you are not replicating, the plain TreeCache will be enough.