You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by "HEWA WIDANA GAMAGE, SUBASH" <Su...@fmr.com> on 2018/08/29 02:52:42 UTC

Can Ignite.getOrCreateCache(CacheConfiguration) return null ?

Hi all,
Is there any possibility for this to happen ? We're using Ignite 1.9.0

Following is the code we use to obtain the cache. And we call this line for every cache operation(unintentionally), but wanted to know if following line can return a null cache instance under any circumstance.

Cache<String, String> cache = getOrCreateCache(CACHE_NAME,CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.SECONDS, 300)));



RE: Can Ignite.getOrCreateCache(CacheConfiguration) return null ?

Posted by "HEWA WIDANA GAMAGE, SUBASH" <Su...@fmr.com>.
Sorry, my bad. Here’s the method. Basically I am directly invoking the Ignition.ignite() with expiry policy.

public static <K, V> Cache<K, V> getOrCreateCache(String name, Factory factory) {
    CacheConfiguration<K, V> cc = newCacheConfig(name);
    cc.setExpiryPolicyFactory(factory);
    cc.setStatisticsEnabled(true);
    return Ignition.ignite().<K, V>getOrCreateCache(cc);
}



From: Denis Mekhanikov [mailto:dmekhanikov@gmail.com]
Sent: Wednesday, August 29, 2018 10:37 AM
To: user@ignite.apache.org
Subject: Re: Can Ignite.getOrCreateCache(CacheConfiguration) return null ?

This email is from an external source - exercise caution regarding links and attachments. Please visit cybersecurity.fmr.com/phishing/ to learn more.

What does the getOrCreateCache method do internally?

Denis

ср, 29 авг. 2018 г. в 5:52, HEWA WIDANA GAMAGE, SUBASH <Su...@fmr.com>>:
Hi all,
Is there any possibility for this to happen ? We’re using Ignite 1.9.0

Following is the code we use to obtain the cache. And we call this line for every cache operation(unintentionally), but wanted to know if following line can return a null cache instance under any circumstance.

Cache<String, String> cache = getOrCreateCache(CACHE_NAME,CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.SECONDS, 300)));



Re: Can Ignite.getOrCreateCache(CacheConfiguration) return null ?

Posted by Denis Mekhanikov <dm...@gmail.com>.
What does the *getOrCreateCache* method do internally?

Denis

ср, 29 авг. 2018 г. в 5:52, HEWA WIDANA GAMAGE, SUBASH <
Subash.HewaWidanaGamage@fmr.com>:

> Hi all,
>
> Is there any possibility for this to happen ? We’re using Ignite 1.9.0
>
>
>
> Following is the code we use to obtain the cache. And we call this line
> for every cache operation(unintentionally), but wanted to know if following
> line can return a null cache instance under any circumstance.
>
>
>
> Cache<String, String> cache =
> getOrCreateCache(CACHE_NAME,CreatedExpiryPolicy.factoryOf(new
> Duration(TimeUnit.SECONDS, 300)));
>
>
>
>
>