Alachisoft.com

Contact Us

+1 (925) 236-3830 sales@alachisoft.com

support@alachisoft.com

Live Chat

TayzGrid Integration with Spring

Spring is a popular Java framework that lets you simplify your application development and plug-in reusable pieces in your application. Many Java applications using Spring are also high transaction in nature. As a result, they need to use in-memory data grid to meet their scalability requirements.

Spring framework has a flexible architecture that allows third party in-memory data grids to plug-in without any code changes to your application. TayzGrid is one such in-memory data grid and is extremely fast and scalable.

TayzGrid provides integration with Spring to let you store your POJO in the data grid and boost your application performance and scalability.


<beans xmlns="http://www.springframework.org/schema/beans" ... >
  <bean id="cacheManager"
        class="com.alachisoft.tayzgrid.integrations.spring.TayzGridCacheManager">
    <property name="tayzGridConfigurationManager"
              ref="tayzgridConfigManager"/>
  </bean>
 
  <bean id="tayzgridConfigManager"
        class="com.alachisoft.tayzgrid.integrations.spring.configuration.TayzGridConfigurationManager">
    <property name="configFile"
              value="C:\...\tayzgrid-spring.xml" />
  </bean>
  <bean id="collectionKeyGenerator"
        class="cachekeygenerator.TayzGridCollectionKeyGenerator"/>
  ...
  <cache:advice id="collectionCacheAdvice"
                key-generator="collectionKeyGenerator">
    <cache:caching cache="CustomerCollectionCache">
      <cache:cache-evict all-entries="true"
                         method="create"/>
      ...
      <cache:cacheable method="findAll"/>
    </cache:caching>
  </cache:advice>
  ...
  <aop:config>
    <aop:advisor advice-ref="collectionCacheAdvice"
                 pointcut="execution(* customerdb.service.CustomerRESTFacade.*(..))"/>
    ...
  </aop:config>
    ...
</beans>

And, below in tayzgrid-spring.xml where you can specify TayzGrid configuration for Spring.


<application-config enable-cache-exception="true"
                    default-cache-name="DefaultCache">
  <caches>
    <cache name="CustomerCollectionCache"
           tayzgrid-instance="mycache"
           priority="normal"
           expiration-type="absolute"
           expiration-period="10"/>
    ...
    <cache name="DefaultCache"
           tayzgrid-instance="mycache"
           priority="normal"
           expiration-type="sliding"
           expiration-period="15" />
  </caches>
</application-config>

What to Do Next?