EhCache in distributed mode

680 views Asked by At

We are trying to use EhCache as a distributed cache in our application. EhCache instance are embedded in our server and we used a terracota cluster.

All our server (and ehcache) instances successfully connect to this tc. We successfully inserts, update and get into each of our caches. But we cannot iterates over any cache.

Maybe we have configured our caches in the wrong way, but it seems that the iterator methods are not yet implemented (in org.ehcache.clustered.client.internal.store.ClusteredStore):

  @Override
  public Iterator<Cache.Entry<K, ValueHolder<V>>> iterator() {
     // TODO: Make appropriate ServerStoreProxy call
     throw new UnsupportedOperationException("Implement me");
  }

Our cache configuration looks like the following:

<service>
    <tc:cluster>
        <tc:connection url="terracotta://10.23.69.20:9510/clustered"/>
        <tc:server-side-config auto-create="true">
            <tc:default-resource from="default-resource"/>
        </tc:server-side-config>
    </tc:cluster>
</service>


<cache-template name="CacheTemplate">
    <resources>
        <tc:clustered-dedicated unit="MB">16</tc:clustered-dedicated>
    </resources>
    <tc:clustered-store consistency="strong"/>
</cache-template>

<cache alias="CacheDaemon" uses-template="CacheTemplate">
    <key-type>java.lang.String</key-type>
    <value-type>com.server.cache.DaemonInstance</value-type>
</cache>

<cache alias="CacheProperty" uses-template="CacheTemplate">
    <key-type>java.lang.String</key-type>
    <value-type>java.lang.String</value-type>
</cache>

I don't found any other way, even getting the key list.

So did we made a mistake in the cache configuration ? Or is it that the EhCache distributed mode is totally incompatible with this method (and so we won't use EhCache).

0

There are 0 answers