Sriranjani Sriraman
Sriranjani Sriraman

Reputation: 51

How to implement clustered cache using terracotta server?

Can someone tell me how to implement Clustered Cache Sharing between two micro-services using terracota server any reference projects would be great to start with

eh-cache.xml

ehcache xml : <?xml version="1.0" encoding="UTF-8"?>

<ehcache:config`enter code here`
  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
  xmlns:terracotta='http://www.ehcache.org/v3/clustered'
  xmlns:ehcache='http://www.ehcache.org/v3'
  xsi:schemaLocation="http://www.ehcache.org/v3 http://www.ehcache.org/schema/ehcache-core-3.8.xsd
    http://www.ehcache.org/v3/clustered http://www.ehcache.org/schema/ehcache-clustered-ext-3.8.xsd">

  <ehcache:service>
    <terracotta:cluster>
      <terracotta:connection url="terracotta://localhost:9410/clustered"/>
      <terracotta:server-side-config auto-create="true">
          <!--<terracotta:default-resource from="default-resource"/>-->
          <terracotta:shared-pool name="shared-pool-expense" unit="MB">100</terracotta:shared-pool>
      </terracotta:server-side-config>
    </terracotta:cluster>
 </ehcache:service>


  <ehcache:cache alias="areaOfCircleCache">
    <ehcache:key-type>java.lang.String</ehcache:key-type>
    <ehcache:value-type>com.db.entity.LogMessage</ehcache:value-type>
    <ehcache:resources>
      <!--      <ehcache:heap unit="entries">100</ehcache:heap>
       <ehcache:offheap unit="MB">10</ehcache:offheap>-->
      <terracotta:clustered-dedicated unit="MB">10</terracotta:clustered-dedicated>
    </ehcache:resources>
  </ehcache:cache>
</ehcache:config>

Upvotes: 0

Views: 786

Answers (1)

Louis Jacomet
Louis Jacomet

Reputation: 14500

This question is quite large. I would recommend starting with the documentation and then asking specific questions if there are things you cannot figure out.

Upvotes: 0

Related Questions