13 releases

0.5.3 Feb 16, 2024
0.5.2 May 12, 2023
0.5.1 Mar 5, 2023
0.5.0 Dec 17, 2022
0.1.0 Jun 13, 2020

#248 in Database interfaces

Download history 6/week @ 2023-12-04 9/week @ 2023-12-11 5/week @ 2023-12-18 6/week @ 2024-01-08 12/week @ 2024-01-22 23/week @ 2024-01-29 13/week @ 2024-02-05 172/week @ 2024-02-12 41/week @ 2024-02-19 234/week @ 2024-02-26 111/week @ 2024-03-04 73/week @ 2024-03-11 49/week @ 2024-03-18

468 downloads per month

BSD-3-Clause

68KB
1.5K SLoC

redis_ts

crates.io Continuous integration

redis_ts provides a small trait with extension functions for the redis crate to allow working with redis time series data that can be installed as a redis module. Time series commands are available as synchronous and asynchronous versions.

The crate is called redis_ts and you can depend on it via cargo. You will also need redis in your dependencies. It has been tested against redis 0.24.0 but should work with versions higher than that.

[dependencies]
redis = "0.24.0"
redis_ts = "0.5.3"

Or via git:

[dependencies.redis_ts]
git = "https://github.com/tompro/redis_ts.git"

With async feature inherited from the redis crate (either: 'async-std-comp' or 'tokio-comp):

 [dependencies]
 redis = "0.24.0"
 redis_ts = { version = "0.5.3", features = ['tokio-comp'] }

Synchronous usage

To enable redis time series commands you simply load the redis_ts::TsCommands into the scope. All redis time series commands will then be available on your redis connection.

use redis::Commands;
use redis_ts::{TsCommands, TsOptions};

let client = redis::Client::open("redis://127.0.0.1/")?;
let mut con = client.get_connection()?;

let _:() = con.ts_create("my_ts", TsOptions::default())?;

Asynchronous usage

To enable redis time series async commands you simply load the redis_ts::TsAsyncCommands into the scope. All redis time series commands will then be available on your async redis connection.

use redis::AsyncCommands;
use redis_ts::{AsyncTsCommands, TsOptions};

let client = redis::Client::open("redis://127.0.0.1/")?;
let mut con = client.get_async_connection().await?;

let _:() = con.ts_create("my_ts", TsOptions::default()).await?;

Compatibility note

Versions >= 0.5 contains a breaking change in the argument list of range queries. With some recent additions in the Redis time series module the number of arguments for ts_range, ts_revrange, ts_mrange and ts_mrevrange have simply grown to long. All existing and the new arguments are now replaced by a single TsRangeQuery struct for which there is also a builder available.

Dependencies

~3–15MB
~204K SLoC