Eric B.
Eric B.

Reputation: 24411

Can Hazelcast be used as a cache manager for a local cache (non-distributed)?

I have Hazelcast 3.12 integrated in my application and using it primarily as a distributed cache among the nodes in my application. I now have the need for creating a local/non-distributed cache. Ideally, I would rather not inject another cache manager in the application.

Is there any way I can configure a Hazelcast cache to work in a non-distributed mode? I cannot seem to find any cache setting that would allow me to create a non-distributed cache. I am trying to avoid object collisions between the different nodes. Additionally, I do not want to guarantee that my objects are all serializable.

Am I forced to make any cached object available to all nodes in the cluster? I realize that I can programatically create unique cache names on each node to ensure that no 2 members use the same cache, but then I have the issue of data being distributed between all the members which is not desired either.

Is there any way to use Hazelcast locally only?

Upvotes: 0

Views: 1106

Answers (1)

Neil Stevenson
Neil Stevenson

Reputation: 3150

See this question & answer, you can have more than one Hazelcast instance in a JVM, and one of them could be isolated so giving you a "local" cache -- distributed, but only distributed on the current JVM.

Hazelcast is intended for distributed caches and you want non-distributed. And, it will insist on serializable cache entries for that reason.

Upvotes: 2

Related Questions