All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.redis.spring.batch.writer.operation.AbstractPushOperation Maven / Gradle / Ivy

There is a newer version: 4.0.7
Show newest version
package com.redis.spring.batch.writer.operation;

import java.util.List;
import java.util.function.Function;

import io.lettuce.core.RedisFuture;
import io.lettuce.core.api.async.BaseRedisAsyncCommands;
import io.lettuce.core.api.async.RedisListAsyncCommands;

public abstract class AbstractPushOperation extends AbstractOperation {

    private Function value;

    public void setValue(Function function) {
        this.value = function;
    }

    @SuppressWarnings("unchecked")
    @Override
    public void execute(BaseRedisAsyncCommands commands, T item, List> futures) {
        futures.add(doPush((RedisListAsyncCommands) commands, key(item), value(item)));
    }

    private V value(T item) {
        return value.apply(item);
    }

    protected abstract RedisFuture doPush(RedisListAsyncCommands commands, K key, V value);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy