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

#443 in Database interfaces

Download history 66/week @ 2024-08-24 16/week @ 2024-08-31 14/week @ 2024-09-14 30/week @ 2024-09-21 35/week @ 2024-09-28 11/week @ 2024-10-05 2/week @ 2024-10-12 12/week @ 2024-10-19 25/week @ 2024-10-26 1/week @ 2024-11-02 9/week @ 2024-11-09 19/week @ 2024-11-16 2/week @ 2024-11-23 9/week @ 2024-11-30 24/week @ 2024-12-07

55 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