Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
262 views
in Technique[技术] by (71.8m points)

caching - distributed cache infinispan and varibale properties in infinispan.xml

so I m using infinispan 11.0 in embedded mode and I have two questions :


First question :


I am building an app for a client and I am going to have multiple caches ( local and distributed ). the thing is when I have one node alive is there a possibility to force the distributed caches to work as a local cache ( i mean stop sending messages to sync with the non-existing nodes something like initial_cluster_size but when the node are below the required number the cache will act as a local cache) to increase performance.


Second question


is there a possibility to pass variables in infinispan.xml because the node names are located in another file so is the possibility to reference the value in infinispan ( using spring for example )?

ps: for this question, I have to deal with infinispan.xml file I know that the request can be treated programmatically

question from:https://stackoverflow.com/questions/65937643/distributed-cache-infinispan-and-varibale-properties-in-infinispan-xml

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

First question

What do you mean by stop sending messages to sync with the non-existing nodes? Infinispan does not send messages to "nobody" and, if you have a single node, the distributed cache does not send any messages to the network. See code here.

Second question

Yes, if you load your properties in a Properties object, you can do something like this:

Properties props = ... //my properties
ParserRegistry reg = new ParserRegistry(Thread.current.getContextClassLoader(), false, props);
ConfigurationBuilderHolder holder = reg.parse(/*infinispan.xml path or File*/); //check other parse methods
DefaultCacheManager manager = new DefaultCacheManager(holder, true);

Reference the key in your infinispan.xml using ${key}.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...