com.redis.spring.batch.writer.operation.AbstractPush Maven / Gradle / Ivy
The newest version!
package com.redis.spring.batch.writer.operation;
import java.util.function.Function;
import org.springframework.batch.item.Chunk;
import io.lettuce.core.RedisFuture;
import io.lettuce.core.api.async.BaseRedisAsyncCommands;
import io.lettuce.core.api.async.RedisListAsyncCommands;
public abstract class AbstractPush extends AbstractKeyWriteOperation {
protected AbstractPush(Function keyFunction) {
super(keyFunction);
}
private Function valueFunction;
public void setValueFunction(Function function) {
this.valueFunction = function;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected void execute(BaseRedisAsyncCommands commands, T item, K key, Chunk> outputs) {
V value = valueFunction.apply(item);
outputs.add((RedisFuture) doPush((RedisListAsyncCommands) commands, key, value));
}
protected abstract RedisFuture
© 2015 - 2024 Weber Informatics LLC | Privacy Policy