接口 RedisMapper<T>

  • 类型参数:
    T - The type of the element handled by this RedisMapper
    所有超级接口:
    org.apache.flink.api.common.functions.Function, Serializable
    所有已知实现类:
    SetRedisMapper

    public interface RedisMapper<T>
    extends org.apache.flink.api.common.functions.Function, Serializable
    Function that creates the description how the input data should be mapped to redis type.

    Example:

    
    private static class RedisTestMapper implements RedisMapper<Tuple2<String, String>> {
        public RedisDataTypeDescription getCommandDescription() {
            return new RedisDataTypeDescription(RedisCommand.PUBLISH);
        }
        public String getKeyFromData(Tuple2<String, String> data) {
            return data.f0;
        }
        public String getValueFromData(Tuple2<String, String> data) {
            return data.f1;
        }
    }
    
    • 方法详细资料

      • getCommandDescription

        RedisCommandDescription getCommandDescription()
        Returns descriptor which defines data type.
        返回:
        data type descriptor
      • getKeyFromData

        String getKeyFromData​(T data)
        Extracts key from data.
        参数:
        data - source data
        返回:
        key
      • getValueFromData

        String getValueFromData​(T data)
        Extracts value from data.
        参数:
        data - source data
        返回:
        value