Using ignite configuration with JCache api

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

Using ignite configuration with JCache api

Hi,

I am using JCache api to create a cache and also to fetch the values from it without references to apache ignite api.

I am using Apache Ignite as Caching provider as I have the required jars in the classpath using maven pom file.

I know we can use apache ignite configuration xml for configuring expiry and eviction policies.

When using JCache, I am not sure how to pass the configuration xml or make the JCache code use the ignite xml for configuring the caches appropriately.

Can someone help me on this.






Denis Magda Denis Magda
Reply | Threaded
Open this post in threaded view
|

Re: Using ignite configuration with JCache api

Hi,

If I understood you properly you're using org.apache.ignite.cache.CachingProvider.
Having look at its source code I see that it gets the configuration from
URL dfltCfgURL = U.resolveIgniteUrl(IgnitionEx.DFLT_CFG);

where
IgnitionEx.DFLT_CFG
refers to
config/default-config.xml

I guess that you should modify this xml file and everything will work fine for you.

Regards,
Denis

On 11/18/2015 9:47 AM, edwardk wrote:
Hi,

I am using JCache api to create a cache and also to fetch the values from it
without references to apache ignite api.

I am using Apache Ignite as Caching provider as I have the required jars in
the classpath using maven pom file.

I know we can use apache ignite configuration xml for configuring expiry and
eviction policies.

When using JCache, I am not sure how to pass the configuration xml or make
the JCache code use the ignite xml for configuring the caches appropriately.

Can someone help me on this.










--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Using-ignite-configuration-with-JCache-api-tp2000.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

edwardk edwardk
Reply | Threaded
Open this post in threaded view
|

Re: Using ignite configuration with JCache api

Hi,

Thanks for your response.

But, I am still not clear on this.

I have ignite-config.xml in my project folder (src/main/resources)

I have used JCache API to create and read from the cache.

In ignite-config.xml I have added cacheConfiguration bean's for each of the caches I have created using JCache api to configure expiry and eviction times respectively .

But, it seems the ignite-config.xml has not be referred at all , as expiry and eviction is not happening as per the configuration.

I even tried adding a config folder(src/main/resources/config) with default-config.xml in it with same configuration as in igntie-config.xml,  but still it is not working as expected.

There should be some way to refer to my cache configuration xml from JCache. But, not sure of how to achieve it.

Thanks,
Sridhar



Denis Magda Denis Magda
Reply | Threaded
Open this post in threaded view
|

Re: Using ignite configuration with JCache api

Sridhar,

Please check where Ignite home directory refers to in your case. Just executed the following code

System
.out.println(System.getProperty(IgniteSystemProperties.IGNITE_HOME))

Then create 'config' folder there and put default-config. xml in this folder.

You can always change Ignite home directory by passing the following VM options upon your apllication launch:
 -DIGNITE_HOME=<some_dir>

--
Denis

On 11/18/2015 1:06 PM, edwardk wrote:
Hi,

Thanks for your response.

But, I am still not clear on this.

I have ignite-config.xml in my project folder (src/main/resources)

I have used JCache API to create and read from the cache.

In ignite-config.xml I have added cacheConfiguration bean's for each of the
caches I have created using JCache api to configure expiry and eviction
times respectively .

But, it seems the ignite-config.xml has not be referred at all , as expiry
and eviction is not happening as per the configuration.

I even tried adding a config folder(src/main/resources/config) with
default-config.xml in it with same configuration as in igntie-config.xml, 
but still it is not working as expected.

There should be some way to refer to my cache configuration xml from JCache.
But, not sure of how to achieve it.

Thanks,
Sridhar







--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Using-ignite-configuration-with-JCache-api-tp2000p2006.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.