【问题标题】:how to cache collection or array parameters with simple-spring-memcache如何使用 simple-spring-memcache 缓存集合或数组参数
【发布时间】:2015-07-28 16:58:02
【问题描述】:

我的项目使用了一个simple-spring-memcache来缓存一个服务方法,但是不起作用,如下:

@ReadThroughSingleCache(namespace = "AdvServiceImpl.findByIdList", expiration = 60)
public List<Adv> findByIdList(@ParameterValueKeyProvider(order = 0) List<String> idList, @ParameterValueKeyProvider(order = 1) String deviceType, @ParameterValueKeyProvider(order = 2) String sourceId) throws Exception {

但我写是为了让它可以工作:

@ReadThroughSingleCache(namespace = "AdvServiceImpl.findByIdList", expiration = 60)
public List<Adv> findByIdList(List<String> idList, @ParameterValueKeyProvider(order = 0) String deviceType, @ParameterValueKeyProvider(order = 1) String sourceId) throws Exception {

【问题讨论】:

    标签: java memcached simple-spring-memcached ssm


    【解决方案1】:

    如果使用 ParameterValueKeyProvider 注释的方法的参数之一是 List 类型,则不应使用@ReadThroughSingleCache。而不是 @ReadThroughSingleCache 尝试使用 @ReadThroughMultiCache

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-23
      • 1970-01-01
      • 2016-02-12
      • 1970-01-01
      • 2021-12-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多