| Crates.io | tin-redis-conn |
| lib.rs | tin-redis-conn |
| version | 0.1.3 |
| created_at | 2025-10-13 00:21:44.842581+00 |
| updated_at | 2025-10-13 00:21:44.842581+00 |
| description | A feature-rich Rust Redis async connection library with JSON serialization support |
| homepage | https://github.com/JiabinTang/tin-redis-conn |
| repository | https://github.com/JiabinTang/tin-redis-conn |
| max_upload_size | |
| id | 1879862 |
| size | 50,354 |
一个功能丰富、易于使用的 Rust Redis 异步连接库,基于 Redis connection-manager 和 tokio-comp。
在 Cargo.toml 中添加依赖:
[dependencies]
tin-redis-conn = "0.1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
use tin_redis_conn::{RedisConnector, RedisUtils, Result};
#[tokio::main]
async fn main() -> Result<()> {
// 创建连接管理器
let connection_manager = RedisConnector::new()
.host("localhost")
.port(6379)
.password("")
.db(0)
.connection_manager()
.await?;
// 创建工具实例
let redis = RedisUtils::new(connection_manager);
// 字符串操作
redis.set("key", "value").await?;
let value: Option<String> = redis.get("key").await?;
println!("Value: {:?}", value);
Ok(())
}
本项目采用 MIT 许可证 - 详见 LICENSE 文件
欢迎贡献代码!请遵循以下步骤:
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)如果您遇到问题或有建议,请:
注意: 请确保 Redis 服务器在运行示例之前已经启动。