Type Alias fred::types::Resp3TimeSeriesValues
source · pub type Resp3TimeSeriesValues<K, Lk, Lv> = HashMap<K, (Vec<(Lk, Lv)>, Vec<(i64, f64)>)>;Available on crate feature
i-time-series only.Expand description
The RESP3 equivalent of Resp2TimeSeriesValues.
The timeseries interface uses slightly different type signatures in RESP3 mode.
async fn example(client: &RedisClient) -> Result<(), RedisError> {
assert_eq!(client.protocol_version(), RespVersion::RESP3);
client
.ts_add("foo", "*", 1.1, None, None, None, None, ("a", "b"))
.await?;
sleep(Duration::from_millis(5)).await;
client
.ts_add("foo", "*", 2.2, None, None, None, None, ("a", "b"))
.await?;
sleep(Duration::from_millis(5)).await;
client
.ts_add("bar", "*", 3.3, None, None, None, None, ("a", "b"))
.await?;
sleep(Duration::from_millis(5)).await;
client
.ts_add("bar", "*", 4.4, None, None, None, None, ("a", "b"))
.await?;
let ranges: Resp3TimeSeriesValues<RedisKey, Str, Str> = client
.ts_mget(false, Some(GetLabels::WithLabels), ["a=b"])
.await?;
for (key, (labels, values)) in ranges.into_iter() {
println!("{} [{:?}] {:?}", key.as_str_lossy(), labels, values);
}
// bar [[("a", "b")]] [(1705355605517, 4.4)]
// foo [[("a", "b")]] [(1705355605504, 2.2)]
Ok(())
}Aliased Type§
struct Resp3TimeSeriesValues<K, Lk, Lv> { /* private fields */ }