Hi All,
I am a newbie to memcache. I have a webservice which will return objects in json format, that one I would like to cache it.I have the following configuration in my application. Though I am not getting any error/exception, doesn't look like it is
working because I can see the generated hql in the logs as many times I
am invoking this service.
I have elastic cache cluster available in Amazone cloude. This is nothing but memcache managed by Amazone. Can I replace this address with DefaultAddressProvider's address?
<context:annotation-config />
<bean class="org.springframework.web.servlet.view.BeanNameViewResolver" />
<bean name="cacheManager" class="com.google.code.ssm.spring.SSMCacheManager">
<property name="caches">
<set>
<bean class="com.google.code.ssm.spring.SSMCache">
<constructor-arg name="cache" index="0" ref="defaultCache"/>
<constructor-arg name="expiration" index="1" value="300"/>
<constructor-arg name="allowClear" index="2" value="false"/>
</bean>
</set>
</property>
</bean>
<bean name="defaultCache" class="com.google.code.ssm.CacheFactory">
<property name="cacheName" value="defaultCache"/>
<property name="cacheClientFactory">
<bean name="cacheClientFactory" class="com.google.code.ssm.providers.xmemcached.MemcacheClientFactoryImpl"/>
</property>
<property name="addressProvider">
<bean class="com.google.code.ssm.config.DefaultAddressProvider">
<property name="address" value="cloudadress:11211"/>
</bean>
</property>
<property name="configuration">
<bean class="com.google.code.ssm.providers.CacheConfiguration">
<property name="consistentHashing" value="true"/>
</bean>
</property>
</bean>
I have added the @Cacheable at method level in one of my Controller class, that invokes db through hibernate
@RequestMapping(method = RequestMethod.GET, value = "/{ids}")
@ResponseBody
@EnableApiRequestResponseLogging
@Cacheable(value = "defaultCache", key = "#ids")
public ResponseEntity<List<MyModel>> read(@PathVariable("ids") String ids, final HttpServletRequest request) throws ServiceException {}
Can someone help me out on this?
Regards,
Kishor