Hi,
I have problem with caching. I do, i hope, everything from manual on GitHub, but cache doesnt work.
I have in:
pom.xml:
<dependency>
<groupId>com.google.code.simple-spring-memcached</groupId>
<artifactId>xmemcached-provider</artifactId>
<version>4.1.1</version>
</dependency>
configuration:
import com.google.code.ssm.CacheFactory;
import com.google.code.ssm.config.AbstractSSMConfiguration;
import com.google.code.ssm.config.DefaultAddressProvider;
import com.google.code.ssm.providers.CacheConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class LocalSSMConfiguration extends AbstractSSMConfiguration {
@Bean
@Override
public CacheFactory defaultMemcachedClient() {
final CacheConfiguration conf = new CacheConfiguration();
conf.setConsistentHashing(true);
final CacheFactory cf = new CacheFactory();
cf.setCacheClientFactory(new com.google.code.ssm.providers.xmemcached.MemcacheClientFactoryImpl());
cf.setAddressProvider(new DefaultAddressProvider("127.0.0.1:11211"));
cf.setConfiguration(conf);
return cf;
}
}
Service impl:
@Service
public class CouponManagementServiceImpl implements CouponManagementService {
private final CouponManagementClient couponManagementClient;
@Autowired
public CouponManagementServiceImpl(CouponManagementClient couponManagementClient) {
this.couponManagementClient = couponManagementClient;
}
@Override
@ReadThroughSingleCache(namespace = "CouponCache", expiration = 3600)
public Object getCouponList(@ParameterValueKeyProvider Integer pClientUID) {
return couponManagementClient.getCouponList(pClientUID);
}
}
I dont know what i miss.
Thank you for help.