Reputation: 377
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
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