
com.redis.spring.batch.writer.SaddAll Maven / Gradle / Ivy
package com.redis.spring.batch.writer;
import java.util.Collection;
import java.util.function.Function;
import org.springframework.util.CollectionUtils;
import io.lettuce.core.RedisFuture;
import io.lettuce.core.api.async.BaseRedisAsyncCommands;
import io.lettuce.core.api.async.RedisSetAsyncCommands;
public class SaddAll extends AbstractKeyValueOperation, T> {
public SaddAll(Function keyFunction, Function> valuesFunction) {
super(keyFunction, valuesFunction, CollectionUtils::isEmpty);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected RedisFuture execute(BaseRedisAsyncCommands commands, T item, K key, Collection value) {
return ((RedisSetAsyncCommands) commands).sadd(key, (V[]) value.toArray());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy