Setting annotation based SpyMemcached configuration in spring mvc

1.4k Views Asked by At

I am new to spring framework. I want to use spy memcached in my application, but i cant find the proper annotation based configuration to set the bean. Currently i am using Memcached static object in my Controller which looks really bad programming. Please provide a simple way to implement memcache in spring configuration. just on default values of memcached "127.0.0.1:11211". Thank you.

edit.

how to convert this xml cinfiguration into proper annitation based config and what to Autowire in cintroller..

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

There are 1 best solutions below

0
On

Take a look at Simple Spring Memcached (SSM) library.

It provides integration to memcached (via spymemcached or xmemcached client) using: