springspring-mvcmemcachedcouchbasesimple-spring-memcached

How to configure Simple Spring Memcached to work with Couchbase


I'm developing a Spring MVC application, and I'd like to set up caching using Simple Spring Memcached (SSM) with a Couchbase backend.

I have setup a working couchbase install locally, with a memcache bucket "default". I can connect and use the Couchbase Java API in a test project.

However, when using the SSM annotations within my Spring MVC project I get timeout exceptions. I'm fairly confident that the issue lies with my SSM configuration:

<bean name="defaultMemcachedClient" class="com.google.code.ssm.CacheFactory">
    <property name="cacheClientFactory">
        <bean name="cacheClientFactory" class="com.google.code.ssm.providers.spymemcached.MemcacheClientFactoryImpl" />
    </property>
    <property name="addressProvider">
        <bean class="com.google.code.ssm.config.DefaultAddressProvider">
            <property name="address" value="127.0.0.1:8091" />
        </bean>
    </property>
    <property name="configuration">
        <bean class="com.google.code.ssm.providers.CacheConfiguration">
            <property name="consistentHashing" value="true" />
        </bean>
    </property>
</bean>

Notice it makes no mention of the "default" bucket, or of any authentication parameters. I haven't been able to find any documentation on how to configure SSM to work with specific couchbase buckets in this way.

Any help?


Solution

  • If you are only using the SSM (Memcached) you need to connect to the memcached port, which is 11211 instead of 8091.