Spring Data GemFire Learning

Source: Internet
Author: User
Tags gemfire

English manual: http://docs.spring.io/spring-data/gemfire/docs/1.5.2.RELEASE/reference/html/(Spring Data GemFire Reference Guide)

The new version configures the spring configuration file without configuring the GemFire Cache.xml directly with the reference namespace.

<?XML version="1.0"Encoding="UTF-8"?><beans xmlns="Http://www.springframework.org/schema/beans" Xmlxsi="Http://www.w3.org/2001/XMLSchema-instance" Xmlns:gfe="Http://www.springframework.org/schema/gemfire" xsi: Schemalocation= "Http://www.springframework.org/schema/beans/http Www.springframework.org/schema/beans/spring-beans.xsd Http://www.springframework.org/schema/gemfire/HTTP Www.springframework.org/schema/gemfire/spring-gemfire.xsd ">  <bean id ... > <gfe:cache ... >  </beans> 

Note description:
<gfe:cache/>创建一个默认的cache:首先Spring会注册一个CacheFactoryBean来创建一个实现了Cache接口的gemfireCache对象。
这个Cache可以是一个既存的也可以是个已经在服务器上存在连接上去的

<gfe:cache id="cache-with-xml" cache-xml-location="classpath:cache.xml"/>
也可以指定用Gemfire本地的配置文件配置。

     <gfe:cache properties-ref="props"/> <util:properties id="props" location="file:/vfabric/gemfire/gemfire.properties"/></beans>
You can also do this by using a referenced properties file configuration.
These configurations are only applied when they are created, and if the cache is already in the JVM, it is ignored

Advanced Cache Configuration
<gfe:cache        Copy-on-read="True" Critical-heap-percentage="70" Eviction-heap-percentage="60" Lock-lease="120" Lock-timeout="60" Pdx-serializer="Mypdxserializer" Pdx-disk-store="Diskstore" Pdx-ignore-unread-fields="True" Pdx-persistent="True" Pdx-read-serialized="False" Message-sync-interval="1" Search-timeout="300" Close="False" Lazy-init="True"> <gfe:transaction-listener Ref="Mytransactionlistener"/> <gfe:transaction-writer>  <bean class= " Org.springframework.data.gemfire.example.TransactionListener "/> </gfe:transaction-writer> <GFE: Dynamic-region-factory/> Allow GemFire Dynamic region Factory <gfe:jndi-binding jndi-name = "myDataSource"  type=  "Manageddatasource" /> declaration Jdni interface Binding external data source </GFE:CACHE>       
More configuration information can be seen GemFire official website http://gemfire.docs.pivotal.io/index.html
close属性表明cache是否和Spring application context 一起关闭
lazy-init是不是等到用的时候才init
TransactionListener 中引用的bean必须实现TransactionListener接口
use-bean-factory-locator属性代表用Spring内部类型BeanFactoryLocator来让定义在cache.xml中的locator注册成一个 Spring beans
In some cases, such as UT and it, settinguse-bean-factory-locator为false,来防止异常,这个异常也会在用Maven build 脚本启动test的时候。测试人员要fork给每个testFork一个新的JVM。
 (in maven, set<forkmode>always</forkmode>

允许PDX序列化



 
 
        
 
 

Spring Data GemFire Learning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.