+ added docs on attribute configs
This commit is contained in:
@@ -70,16 +70,16 @@
|
||||
|
||||
<programlisting language="xml"><?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
|
||||
|
||||
<bean id="cache-with-props" class="org.springframework.data.gemfire.CacheFactoryBean">
|
||||
<property name="properties">
|
||||
<util:properties location="classpath:/deployment/env.properties"/>
|
||||
</property>
|
||||
</bean>
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
|
||||
|
||||
<bean id="cache-with-props" class="org.springframework.data.gemfire.CacheFactoryBean">
|
||||
<property name="properties">
|
||||
<util:properties location="classpath:/deployment/env.properties"/>
|
||||
</property>
|
||||
</bean>
|
||||
</beans></programlisting>
|
||||
|
||||
<para>It is worth pointing out again, that the cache settings apply only
|
||||
@@ -110,10 +110,10 @@
|
||||
<emphasis>basic</emphasis> using a nested cache declaration:</para>
|
||||
|
||||
<programlisting language="xml"><bean id="basic" class="org.springframework.data.gemfire.RegionFactoryBean">
|
||||
<property name="cache">
|
||||
<bean class="org.springframework.data.gemfire.CacheFactoryBean"/>
|
||||
</property>
|
||||
<property name="name" value="basic"/>
|
||||
<property name="cache">
|
||||
<bean class="org.springframework.data.gemfire.CacheFactoryBean"/>
|
||||
</property>
|
||||
<property name="name" value="basic"/>
|
||||
</bean></programlisting>
|
||||
|
||||
<para>Since the region bean definition name is usually the same with that
|
||||
@@ -125,13 +125,13 @@
|
||||
|
||||
<programlisting language="xml"><?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:p="http://www.springframework.org/schema/p"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:p="http://www.springframework.org/schema/p"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<!-- shared cache across regions -->
|
||||
<bean id="cache" class="org.springframework.data.gemfire.CacheFactoryBean"/>
|
||||
|
||||
|
||||
<!-- region named 'basic' -->
|
||||
<bean id="basic" class="org.springframework.data.gemfire.RegionFactoryBean" p:cache-ref="cache"/>
|
||||
|
||||
@@ -147,18 +147,18 @@
|
||||
|
||||
<programlisting language="xml"><bean id="cacheLogger" class="org.some.pkg.CacheLogger"/>
|
||||
<bean id="customized-region" class="org.springframework.data.gemfire.RegionFactoryBean" p:cache-ref="cache">
|
||||
<property name="cacheListeners">
|
||||
<array>
|
||||
<ref name="cacheLogger"/>
|
||||
<bean class="org.some.other.pkg.SysoutLogger"/>
|
||||
</array>
|
||||
</property>
|
||||
<property name="cacheLoader"><bean class="org.some.pkg.CacheLoad"/></property>
|
||||
<property name="cacheWriter"><bean class="org.some.pkg.CacheWrite"/></property>
|
||||
<property name="cacheListeners">
|
||||
<array>
|
||||
<ref name="cacheLogger"/>
|
||||
<bean class="org.some.other.pkg.SysoutLogger"/>
|
||||
</array>
|
||||
</property>
|
||||
<property name="cacheLoader"><bean class="org.some.pkg.CacheLoad"/></property>
|
||||
<property name="cacheWriter"><bean class="org.some.pkg.CacheWrite"/></property>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="local-region" class="org.springframework.data.gemfire.RegionFactoryBean" p:cache-ref="cache">
|
||||
<property name="cacheListeners" ref="cacheLogger"/>
|
||||
<property name="cacheListeners" ref="cacheLogger"/>
|
||||
</bean></programlisting>
|
||||
|
||||
<section id="bootstrap:region:client">
|
||||
@@ -175,15 +175,37 @@
|
||||
<literal>org.springframework.data.gemfire</literal> package:</para>
|
||||
|
||||
<programlisting language="xml"><bean id="interested-client" class="org.springframework.data.gemfire.ClientRegionFactoryBean" p:cache-ref="cache" p:name="client-region">
|
||||
<property name="interests">
|
||||
<array>
|
||||
<!-- key-based interest -->
|
||||
<bean class="org.springframework.data.gemfire.Interest" p:key="Vlaicu" p:policy="NONE"/>
|
||||
<!-- regex-based interest -->
|
||||
<bean class="org.springframework.data.gemfire.RegexInterest" p:key=".*" p:policy="KEYS" p:durable="true"/>
|
||||
</array>
|
||||
</property>
|
||||
<property name="interests">
|
||||
<array>
|
||||
<!-- key-based interest -->
|
||||
<bean class="org.springframework.data.gemfire.Interest" p:key="Vlaicu" p:policy="NONE"/>
|
||||
<!-- regex-based interest -->
|
||||
<bean class="org.springframework.data.gemfire.RegexInterest" p:key=".*" p:policy="KEYS" p:durable="true"/>
|
||||
</array>
|
||||
</property>
|
||||
</bean></programlisting>
|
||||
</section>
|
||||
|
||||
<section id="bootstrap:region:attributes">
|
||||
<title>Advanced configuration through a <interfacename>Region</interfacename>'s <emphasis>attributes</emphasis></title>
|
||||
|
||||
<para>Users that need fine control over a region, can configure it in Spring by using the <literal>attributes</literal> property. To ease declarative configuration in Spring,
|
||||
SGI provides two <interfacename>FactoryBean</interfacename>s for creating <interfacename>RegionAttributes</interfacename> and <interfacename>PartitionAttributes</interfacename>,
|
||||
namely <classname>RegionAttributesFactory</classname> and <classname>PartitionAttributesFactory</classname>. See below an example of configuring a partitioned region through Spring
|
||||
XML:</para>
|
||||
|
||||
<programlisting language="xml"><![CDATA[<bean id="partitioned-region" class="org.springframework.data.gemfire.RegionFactoryBean" p:cache-ref="cache">
|
||||
<property name="attributes">
|
||||
<bean class="org.springframework.data.gemfire.RegionAttributesFactory" p:initial-capacity="1024">
|
||||
<property name="partitionAttributes">
|
||||
<bean class="org.springframework.data.gemfire.PartitionAttributesFactory" p:redundant-copies="2" p:local-max-memory="512"/>
|
||||
</property>
|
||||
</bean>
|
||||
</property>
|
||||
</bean>]]>
|
||||
</programlisting>
|
||||
|
||||
<para>By using the attribute factories above, one can reduce the size of the <literal>cache.xml</literal> or even eliminate it all together.</para>
|
||||
</section>
|
||||
</section>
|
||||
</chapter>
|
||||
</chapter>
|
||||
Reference in New Issue
Block a user