redis遇到的问题

redis中遇到的问题

/**
 * 为指定KEY设置List值
 * @param key
 * @param list
 * @return
 */
public boolean setListByKey(String key, List<?> list, Long expires){
    if(null==key){
        return false;
    }
    redisTemplate.opsForList().rightPushAll(key, list);
    return redisTemplate.expire(key, expires, TimeUnit.SECONDS);
}
知识兔

rightPushAll需要使用rightPushAll(K key, Collection<V> values) ,但是实际调用了前一个方法rightPushAll(K key, V... values
知识兔
public Long rightPushAll(K key, V... values) {
   final byte[] rawKey = rawKey(key);
   final byte[][] rawValues = rawValues(values);
   return execute(new RedisCallback<Long>() {
      public Long doInRedis(RedisConnection connection) {
         return connection.rPush(rawKey, rawValues);
      }
   }, true);
}

@Override
public Long rightPushAll(K key, Collection<V> values) {

   final byte[] rawKey = rawKey(key);
   final byte[][] rawValues = rawValues(values);

   return execute(new RedisCallback<Long>() {
      public Long doInRedis(RedisConnection connection) {
         return connection.rPush(rawKey, rawValues);
      }
   }, true);
}
知识兔
解决方式
强制修改参数
知识兔
public boolean setListByKey(String key, List<?> list, Long expires){
    if(null==key){
        return false;
    }
    redisTemplate.opsForList().rightPushAll(key, (Collection)list);
    return redisTemplate.expire(key, expires, TimeUnit.SECONDS);
}
知识兔
计算机