用于集群式Spring应用程序的Hazelcast缓存 [英] Hazelcast Caching for Clusterd Spring Application

查看:62
本文介绍了用于集群式Spring应用程序的Hazelcast缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们最近将Spring应用程序与由一个数据库支持的2个节点进行了集群。
我们的应用程序具有动态菜单(每个用户具有不同的菜单选项),因为每次用户登录时我们没有足够的缓存位置,因此我们访问数据库并根据用户安全性过滤菜单选项。我们想避免每次用户通过引入Cache来访问数据库。



我在阅读有关hazelcast缓存 http://hazelcast.org的信息/ use-cases / caching / ,我注意到有多个可用的缓存选项,例如内存数据网格/ NoSql Jcache Spring Cache ,但不确定哪一个是缓存Menu项(字符串类型)的最佳解决方案。据我了解,我觉得 Spring Cache 是适用于我的用例的正确解决方案,如果没有,请向我建议其他hazelcast缓存选项。 = h2_lin>解决方案

Spring Caching支持Hazelcast(或Hazelcast提供与Spring Caching :)的集成)。
如果您使用 Spring 4 及更高版本,则可以使用来自Spring Framework的 JCache 缓存支持。
您可以在此处找到用法示例。
寻找 spring-* 项目。



Spring Boot也受支持。观看网络研讨会录制,阅读我的博客文章,在此处找到代码示例



让我知道您是否有任何疑问。



谢谢


We recently clusterd our Spring application with 2 nodes backed by one database. Our application has Dynamic menu(each user has different menu options), since we dont have enough caching in place every time user logs we hit the database and filter the Menu options based on user security. We want to avoid hitting the database each time user logs in by introducing Cache.

I was reading about hazelcast cache http://hazelcast.org/use-cases/caching/ and I noticed multiple options available for caching like In-Memory Data Grid/NoSql, Jcache and Spring Cache but not really sure which one is the best solution to cache the Menu items(String type). From my understanding I felt Spring Cache is the correct solution for my use case, if not please suggest me other hazelcast caching options.

解决方案

Spring Caching supports Hazelcast (or Hazelcast provides integration with Spring Caching :) ). If you use Spring 4 and higher, you can use JCache caching support from Spring Framework. You can find examples of usage here. Look for spring-* projects.

Spring Boot also supported. Watch the webinar recording, read my blog post, find code samples here.

Let me know if you have any questions.

Thank you

这篇关于用于集群式Spring应用程序的Hazelcast缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆