sabi_redis for Rust

The sabi data access library for Redis in Rust.
sabi_redis is a Rust crate that provides a streamlined way to access various Redis configurations
within the sabi framework. It includes DataSrc and DataConn derived classes designed to make
your development process more efficient
RedisDataSrc and RedisDataConn are designed for a standalone Redis server and provide
synchronous connections for processing Redis commands. Additionally, RedisAsyncDataSrc and
RedisAsyncDataConn are available for asynchronous command processing.
For Redis Sentinel configurations, RedisSentinelDataSrc and RedisSentinelDataConn provide
synchronous connections, while RedisSentinelAsyncDataSrc and RedisSentinelAsyncDataConn
provide asynchronous connections.
For Redis Cluster configurations, RedisClusterDataSrc and RedisClusterDataConn provide
synchronous connections, while RedisClusterAsyncDataSrc and RedisClusterAsyncDataConn
provide asynchronous connections.
Unlike relational databases, Redis does not support data rollbacks. This can lead to data
inconsistency if a transaction involving both Redis and another database fails mid-process.
To address this, sabi_redis offers three unique features to help developers manage Redis updates
and revert changes when necessary: "force back", "pre-commit", and "post-commit".
Installation
In Cargo.toml, write this crate as a dependency:
[]
= "0.4.1" # `standalone-sync` feature is enabled by default.
# If you want to use the `standalone-async` feature:
# sabi_redis = { version = "0.4.1", default-features = false, features = ["standalone-async"] }
# If you want to use the `sentinel-sync` feature:
# sabi_redis = { version = "0.4.1", default-features = false, features = ["sentinel-sync"] }
# If you want to use the `sentinel-async` feature:
# sabi_redis = { version = "0.4.1", default-features = false, features = ["sentinel-async"] }
# If you want to use the `cluster-sync` feature:
# sabi_redis = { version = "0.4.1", default-features = false, features = ["cluster-sync"] }
# If you want to use the `cluster-async` feature:
# sabi_redis = { version = "0.4.1", default-features = false, features = ["cluster-async"] }
Usage
For Standalone Server And Synchronous Commands
The
standalone-syncfeature is required for this functionality, and it is enabled by default.
Here is an example of how to use RedisDataSrc and RedisDataConn to connect to Redis and
execute a simple command.
use errs;
use ;
use TypedCommands;
use ;
use ;
For Standalone Server And Asynchronous Commands
The
standalone-asyncfeature is required for this functionality.
Here is an example of how to use RedisAsyncDataSrc and RedisAsyncDataConn to connect to Redis and
execute a simple asynchronous command.
use errs;
use ;
use AsyncCommands;
use ;
use ;
async
async
async
For Sentinel Configuration And Synchronous Commands
The
sentinel-syncfeature is required for this functionality.
use errs;
use ;
use RedisSentinelDataSrc;
For Sentinel Configuration And Asynchronous Commands
The
sentinel-asyncfeature is required for this functionality.
use errs;
use ;
use RedisSentinelAsyncDataSrc;
async
For Cluster Configuration And Synchronous Commands
The
cluster-syncfeature is required for this functionality.
use errs;
use ;
use RedisClusterDataSrc;
For Cluster Configuration And Asynchronous Commands
The
cluster-asyncfeature is required for this functionality.
use errs;
use ;
use RedisClusterAsyncDataSrc;
async
Supported Rust versions
This crate supports Rust 1.87.0 or later.
)
License
Copyright (C) 2025-2026 Takayuki Sato
This program is free software under MIT License. See the file LICENSE in this distribution for more details.