#redis #fred #kvrocks

nightly xkv

use global static vars connect redis with fred or kvrocks / 使用全局静态变量通过 fred 连接 redis 或 kvrocks

34 releases

0.1.44 Jan 22, 2025
0.1.30 Dec 31, 2024
0.1.29 Aug 5, 2024
0.1.28 Jul 10, 2024
0.1.10 Jun 19, 2023

#342 in #redis

Download history 4/week @ 2024-10-29 7/week @ 2024-11-05 1/week @ 2024-11-19 7/week @ 2024-11-26 2/week @ 2024-12-10 143/week @ 2024-12-31 774/week @ 2025-01-07 21/week @ 2025-01-14 341/week @ 2025-01-21 20/week @ 2025-01-28 20/week @ 2025-02-04

439 downloads per month
Used in 4 crates

MulanPSL-2.0

22KB
268 lines

xkv

use global static vars connect redis / kvrocks with fred

使用全局静态变量通过 fred 连接 redis / kvrocks


use aok::{Result, OK};
use xkv::{
  fred::interfaces::KeysInterface,
  tracing::info,
  R,
};

async fn test_redis() -> Result<()> {
  let key = "xkvtest1";
  let val = "abc";
  R!(del key);

  let v: bool = R.exists(key).await?;
  assert!(!v);

  let v: Option<String> = R.get(key).await?;
  info!("get {key} = {:?}", v);
  assert_eq!(v, None);

  R!(set key, val, None, None, false);

  let v: Option<String> = R.get(key).await?;
  info!("get {key} = {:?}", v);
  assert_eq!(v, Some(val.into()));

  R!(del key);

  OK
}

#[tokio::main]
async fn main() -> Result<()> {
  // 仅在程序启动的main函数中调用一次 / Call it only once in the main function of the program
  static_::init().await?;
  test_redis().await?;
  OK
}

About

This project is an open-source component of i18n.site ⋅ Internationalization Solution.

关于

本项目为 i18n.site ⋅ 国际化解决方案 的开源组件。

Dependencies

~17–28MB
~511K SLoC