
com.redis.spring.batch.writer.Geoadd Maven / Gradle / Ivy
package com.redis.spring.batch.writer;
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 AbstractKeyValueOperation, T> {
private Function argsFunction = t -> null;
public Geoadd(Function keyFunction, Function> valueFunction) {
super(keyFunction, valueFunction);
}
public void setArgs(GeoAddArgs args) {
this.argsFunction = t -> args;
}
public void setArgsFunction(Function args) {
this.argsFunction = args;
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected RedisFuture execute(BaseRedisAsyncCommands commands, T item, K key, GeoValue value) {
return ((RedisGeoAsyncCommands) commands).geoadd(key, argsFunction.apply(item), value);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy