缓存机制集群环境 [英] Caching mechanism cluster environment

查看:231
本文介绍了缓存机制集群环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我们在普通类(不是singelton类)中使用静态哈希映射来缓存进程它是否可以在集群环境中工作?

If we use a static hash map for caching process in a normal class (Not a singelton class) will it work in cluster environment?

推荐答案

静态字段的值存储在JVM的内存中,因此每个JVM都有自己的静态映射。这可以,但除非您想为群集的所有成员提供唯一的缓存。

A static field's value is stored in the memory of the JVM, and each JVM will thus have its own static map. This can be OK, unless you want a unique cache for all the members of the cluster.

这篇关于缓存机制集群环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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