aol
aol

Reputation: 377

Apache Ignite difference between ignite.getOrCreateCache() vs ignite.cache()

I would like to clarify the differences between the following:

ignite.getOrCreateCache(cfg);

and

ignite.cache("cacheName")

The documentation on cache() says it

Gets an instance of IgniteCache API.

As for getOrCreateCache,

Gets existing cache with the given name or creates new one with the given configuration.

But they both return IgniteCache. Thank you!

https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/Ignite.html

Upvotes: 1

Views: 1095

Answers (1)

Valentin Kulichenko
Valentin Kulichenko

Reputation: 8390

With getOrCreateCache you can provide cache configuration that will be used to create new cache in case it doesn't exist yet. cache method will return null in this case.

Upvotes: 3

Related Questions