FlinkSink
将数据保存到redis中
class New_class extends RedisMapper[T]{
override def getCommandDescription: RedisCommandDescription =
new RedisCommandDescription(RedisCommand.HSET, "totalproduce")
override def getKeyFromData(t: ItemViewCount): String = t.ItemId.toString
override def getValueFromData(t: ItemViewCount): String = t.count.toString
}
继承和使用RedisMapper方法,参数T就是你的传入数据类型,
getCommandDescription函数主要是顶部一你要以什么样子的方式存入数据
getKeyFromData设置redis的键
getValueFromData设置redis的值