cache.getCacheManager() returns null.

classic Classic list List threaded Threaded
4 messages Options
vinshar vinshar
Reply | Threaded
Open this post in threaded view
|

cache.getCacheManager() returns null.

Hi,

Below code prints null. is this expected? is there any way to get Ignite instance from a cache instance?


ignite = Ignition.start("cache-server-test-node.xml");
                System.out.println("################################################# "+ignite.cache("TEST_REPLICATED").getCacheManager());

below is cache configuration

<bean class="org.apache.ignite.configuration.CacheConfiguration">
                                        <property name="name" value="TEST_REPLICATED" />
                                        <property name="cacheMode" value="REPLICATED" />
                                        <property name="managementEnabled" value="true" />
                                        <property name="statisticsEnabled" value="true" />
                                        <property name="evictionPolicy">
                                                <bean class="org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy">
                                                        <property name="maxSize" value="20000" />
                                                </bean>
                                        </property>
                                        <property name="startSize" value="21000" />
                                </bean>


Regards,
Vinay
               
vkulichenko vkulichenko
Reply | Threaded
Open this post in threaded view
|

Re: cache.getCacheManager() returns null.

Hi Vinay,

getCacheManager() will return the instance of JCache manager [1] if you used one to create a cache. If you created it using Ignite API, it will be null.

To get an Ignite instance from IgniteCache do this: 'Ignite ignite = cache.unwrap(Ignite.class)'

[1] https://ignite.apache.org/releases/1.5.0.final/javadoc/org/apache/ignite/cache/CacheManager.html

-Val
vinshar vinshar
Reply | Threaded
Open this post in threaded view
|

Re: cache.getCacheManager() returns null.

Is there any documentation or example to use jcache with ignite as implementation?

On Jan 24, 2016 6:46 PM, "vkulichenko [via Apache Ignite Users]" <[hidden email]> wrote:
Hi Vinay,

getCacheManager() will return the instance of JCache manager [1] if you used one to create a cache. If you created it using Ignite API, it will be null.

To get an Ignite instance from IgniteCache do this: 'Ignite ignite = cache.unwrap(Ignite.class)'

[1] https://ignite.apache.org/releases/1.5.0.final/javadoc/org/apache/ignite/cache/CacheManager.html

-Val


If you reply to this email, your message will be added to the discussion below:
http://apache-ignite-users.70518.x6.nabble.com/cache-getCacheManager-returns-null-tp2676p2682.html
To unsubscribe from cache.getCacheManager() returns null., click here.
NAML
Denis Magda Denis Magda
Reply | Threaded
Open this post in threaded view
|

Re: cache.getCacheManager() returns null.

I couldn't find any useful example on this.

However, you can refer to this test that showcases how it works in practice
https://github.com/apache/ignite/blob/b3d347e35a254928fd1c4a0473f1b17d642c72f3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCachingProviderSelfTest.java

--
Denis