14 releases

0.5.4 Apr 2, 2024
0.5.3 Feb 16, 2024
0.5.2 May 12, 2023
0.5.1 Mar 5, 2023
0.1.0 Jun 13, 2020

#408 in Database interfaces

Download history 113/week @ 2024-07-15 1252/week @ 2024-07-22 26/week @ 2024-07-29 5/week @ 2024-08-19 72/week @ 2024-08-26 10/week @ 2024-09-02 16/week @ 2024-09-16 29/week @ 2024-09-23 34/week @ 2024-09-30 13/week @ 2024-10-07 12/week @ 2024-10-21 26/week @ 2024-10-28

51 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.25.2 but should work with versions higher than that.

[dependencies]
redis = "0.25.2"
redis_ts = "0.5.4"

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.25.2"
 redis_ts = { version = "0.5.4", 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

~4–15MB
~200K SLoC