com.redis.spring.batch.writer.operation.Geoadd Maven / Gradle / Ivy
package com.redis.spring.batch.writer.operation;
import java.util.List;
import java.util.function.Function;
import io.lettuce.core.GeoAddArgs;
import io.lettuce.core.GeoValue;
import io.lettuce.core.RedisFuture;
import io.lettuce.core.api.async.BaseRedisAsyncCommands;
import io.lettuce.core.api.async.RedisGeoAsyncCommands;
public class Geoadd extends AbstractOperation {
private Function> value;
private Function args = t -> null;
public void setValue(Function> value) {
this.value = value;
}
public void setArgs(Function args) {
this.args = args;
}
@SuppressWarnings("unchecked")
@Override
public void execute(BaseRedisAsyncCommands commands, T item, List> futures) {
futures.add(((RedisGeoAsyncCommands) commands).geoadd(key(item), args(item), value(item)));
}
private GeoValue value(T item) {
return value.apply(item);
}
private GeoAddArgs args(T item) {
return args.apply(item);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy