You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Josh Cummings <jo...@workfront.com> on 2016/08/29 17:48:43 UTC

Dynamic caches over JCache

I am trying to do the following:

CacheManager cm = Caching.getCachingProvider().getCacheManager();
Cache cache = cm.getCache("my-cache");

At this point, cm points to an instance of
org.apache.ignite.cache.CacheManager and cache points to null.

I figured that Ignite would simply create the cache dynamically, but it
appears that CacheManager#getCache calls ignite.cache instead of
ignite.getOrCreateCache.

What is the correct way to use JCache and dynamically create a cache?

-- 

*JOSH CUMMINGS*

Principal Engineer

[image: Workfront] <https://www.workfront.com/>

*O*  801.477.1234  |  *M*  8015562751

joshcummings@workfront.com | www.workfront.com
Address <https://www.workfront.com/contact-us/>  |  Twitter
<http://twitter.com/Workfront_Inc>  |  LinkedIn
<http://www.linkedin.com/company/48453>  |  Facebook
<http://www.facebook.com/workfront>

[image: Workfront] <https://www.workfront.com/email-promo>

Re: Dynamic caches over JCache

Posted by vkulichenko <va...@gmail.com>.
Josh,

You should use CacheManager.createCache to create it. As per spec, the
getCache() method returns 'the Cache or null if it does exist or can't be
pre-configured'. Unfortunately, CacheManager doesn't have anything like
getOrCreateCache.

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Dynamic-caches-over-JCache-tp7378p7384.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.