You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by edwardk <ek...@gmail.com> on 2015/11/12 09:43:56 UTC

Multiple Caches in same configuration XML ?

Hi,

I want to configure multiple caches in apache ignite cache configuration xml
with different expiry and eviction times and also modes.

I was able to do so for one cache(name: 'plans') by adding a property
cacheConfiguration to the IgniteConfiguration bean and setting its
properties as below.

       <property name="cacheConfiguration">
			        <bean class="org.apache.ignite.configuration.CacheConfiguration">
			            
			            <property name="name" value="plans"/>
			            <property name="expiryPolicyFactory">
								   <bean id="expiryPolicy"
class="javax.cache.expiry.CreatedExpiryPolicy"
								factory-method="factoryOf">
								     <constructor-arg>
								       <bean class="javax.cache.expiry.Duration">
								         <constructor-arg value="MILLISECONDS"/>
								         <constructor-arg value="6000"/>
								       </bean>
								     </constructor-arg>
								   </bean>
						</property>
						<property name="evictionPolicy">
					        <bean
class="org.apache.ignite.cache.eviction.lru.LruEvictionPolicy">
					            <property name="maxSize" value="1000000"/>
					        </bean>
					    </property>
						
			            
			            <property name="cacheMode" value="PARTITIONED"/>
			             
			        </bean>
			        
			        
			        
	    </property>

When I want to configure the settings in a different way for another cache
with 'name' , say, customers, how would I do that in same configuration
file.

I tried adding another CacheConfiguration bean but was not able to do so.

How can I add another bean of type CacheConfiguration in same xml and
configure the properties differently.

If not is there way I can configure settings separate for each cache (plans,
customers, etc.,) in XML.


Thanks,
edwardk





--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Multiple-Caches-in-same-configuration-XML-tp1939.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Multiple Caches in same configuration XML ?

Posted by Anton Vinogradov <av...@gridgain.com>.
Also,
Please properly subscribe to the user list (this way we will not have to
manually approve your emails).
All you need to do is send an email to “user-subscribe@ignite.apache.org”
and follow simple instructions in the reply.

On Thu, Nov 12, 2015 at 12:56 PM, Anton Vinogradov <avinogradov@gridgain.com
> wrote:

> Hello,
>
> please try to do something similar to following:
>
>  <property name="cacheConfiguration">
>             <list>
>                 <bean
> class="org.apache.ignite.configuration.CacheConfiguration">
>                     <property name="name" value="atomic"/>
>
>                     <property name="cacheMode" value="PARTITIONED"/>
>
>                     <property name="atomicityMode" value="ATOMIC"/>
>
>                     <property name="swapEnabled" value="false"/>
>                 </bean>
>
>                 <bean
> class="org.apache.ignite.configuration.CacheConfiguration">
>                     <property name="name" value="atomic-offheap"/>
>
>                     <property name="cacheMode" value="PARTITIONED"/>
>
>                     <property name="atomicityMode" value="ATOMIC"/>
>
>                     <property name="swapEnabled" value="false"/>
>
>                     <property name="memoryMode" value="OFFHEAP_TIERED"/>
>                 </bean>
>           </list>
>
> </property>
>
> On Thu, Nov 12, 2015 at 11:43 AM, edwardk <ek...@gmail.com> wrote:
>
>> Hi,
>>
>> I want to configure multiple caches in apache ignite cache configuration
>> xml
>> with different expiry and eviction times and also modes.
>>
>> I was able to do so for one cache(name: 'plans') by adding a property
>> cacheConfiguration to the IgniteConfiguration bean and setting its
>> properties as below.
>>
>>        <property name="cacheConfiguration">
>>                                 <bean
>> class="org.apache.ignite.configuration.CacheConfiguration">
>>
>>                                     <property name="name" value="plans"/>
>>                                     <property name="expiryPolicyFactory">
>>                                                                    <bean
>> id="expiryPolicy"
>> class="javax.cache.expiry.CreatedExpiryPolicy"
>>
>> factory-method="factoryOf">
>>
>>  <constructor-arg>
>>
>>  <bean class="javax.cache.expiry.Duration">
>>
>>  <constructor-arg value="MILLISECONDS"/>
>>
>>  <constructor-arg value="6000"/>
>>
>>  </bean>
>>
>>  </constructor-arg>
>>                                                                    </bean>
>>                                                 </property>
>>                                                 <property
>> name="evictionPolicy">
>>                                                 <bean
>> class="org.apache.ignite.cache.eviction.lru.LruEvictionPolicy">
>>                                                     <property
>> name="maxSize" value="1000000"/>
>>                                                 </bean>
>>                                             </property>
>>
>>
>>                                     <property name="cacheMode"
>> value="PARTITIONED"/>
>>
>>                                 </bean>
>>
>>
>>
>>             </property>
>>
>> When I want to configure the settings in a different way for another cache
>> with 'name' , say, customers, how would I do that in same configuration
>> file.
>>
>> I tried adding another CacheConfiguration bean but was not able to do so.
>>
>> How can I add another bean of type CacheConfiguration in same xml and
>> configure the properties differently.
>>
>> If not is there way I can configure settings separate for each cache
>> (plans,
>> customers, etc.,) in XML.
>>
>>
>> Thanks,
>> edwardk
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://apache-ignite-users.70518.x6.nabble.com/Multiple-Caches-in-same-configuration-XML-tp1939.html
>> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>>
>
>

Re: Multiple Caches in same configuration XML ?

Posted by Anton Vinogradov <av...@gridgain.com>.
Hello,

please try to do something similar to following:

 <property name="cacheConfiguration">
            <list>
                <bean
class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="atomic"/>

                    <property name="cacheMode" value="PARTITIONED"/>

                    <property name="atomicityMode" value="ATOMIC"/>

                    <property name="swapEnabled" value="false"/>
                </bean>

                <bean
class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="atomic-offheap"/>

                    <property name="cacheMode" value="PARTITIONED"/>

                    <property name="atomicityMode" value="ATOMIC"/>

                    <property name="swapEnabled" value="false"/>

                    <property name="memoryMode" value="OFFHEAP_TIERED"/>
                </bean>
          </list>

</property>

On Thu, Nov 12, 2015 at 11:43 AM, edwardk <ek...@gmail.com> wrote:

> Hi,
>
> I want to configure multiple caches in apache ignite cache configuration
> xml
> with different expiry and eviction times and also modes.
>
> I was able to do so for one cache(name: 'plans') by adding a property
> cacheConfiguration to the IgniteConfiguration bean and setting its
> properties as below.
>
>        <property name="cacheConfiguration">
>                                 <bean
> class="org.apache.ignite.configuration.CacheConfiguration">
>
>                                     <property name="name" value="plans"/>
>                                     <property name="expiryPolicyFactory">
>                                                                    <bean
> id="expiryPolicy"
> class="javax.cache.expiry.CreatedExpiryPolicy"
>
> factory-method="factoryOf">
>
>  <constructor-arg>
>
>  <bean class="javax.cache.expiry.Duration">
>
>  <constructor-arg value="MILLISECONDS"/>
>
>  <constructor-arg value="6000"/>
>
>  </bean>
>
>  </constructor-arg>
>                                                                    </bean>
>                                                 </property>
>                                                 <property
> name="evictionPolicy">
>                                                 <bean
> class="org.apache.ignite.cache.eviction.lru.LruEvictionPolicy">
>                                                     <property
> name="maxSize" value="1000000"/>
>                                                 </bean>
>                                             </property>
>
>
>                                     <property name="cacheMode"
> value="PARTITIONED"/>
>
>                                 </bean>
>
>
>
>             </property>
>
> When I want to configure the settings in a different way for another cache
> with 'name' , say, customers, how would I do that in same configuration
> file.
>
> I tried adding another CacheConfiguration bean but was not able to do so.
>
> How can I add another bean of type CacheConfiguration in same xml and
> configure the properties differently.
>
> If not is there way I can configure settings separate for each cache
> (plans,
> customers, etc.,) in XML.
>
>
> Thanks,
> edwardk
>
>
>
>
>
> --
> View this message in context:
> http://apache-ignite-users.70518.x6.nabble.com/Multiple-Caches-in-same-configuration-XML-tp1939.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>