Is not caching the entries in memcached

30 views
Skip to first unread message

Lukas Kin

unread,
Nov 17, 2018, 10:09:58 AM11/17/18
to simple-spring-memecached
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.

Jakub Białek

unread,
Nov 19, 2018, 5:16:07 AM11/19/18
to simple-sprin...@googlegroups.com
Hi,

It seams that your configuration is correct. 
Could you please provide a sample project where caching doesn't work?

-- Ragnor

--
You received this message because you are subscribed to the Google Groups "simple-spring-memecached" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simple-spring-meme...@googlegroups.com.
To post to this group, send email to simple-sprin...@googlegroups.com.
Visit this group at https://groups.google.com/group/simple-spring-memecached.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages