Skip to main content

Crate redisgo

Crate redisgo 

Source
Expand description

§RedisGo

A simple and ergonomic Redis client wrapper for Rust.

RedisGo provides a convenient API for common Redis operations such as setting, getting, deleting keys, and more. It uses a singleton pattern for easy access throughout your application.

§Quick Start

Set the REDIS_URL environment variable or create a .env file:

REDIS_URL=redis://127.0.0.1/

Then use the library:

use redisgo::RedisGo;

fn main() -> redis::RedisResult<()> {
    // Set a value
    RedisGo::set("my_key", "my_value")?;

    // Get a value
    let value: Option<String> = RedisGo::get("my_key")?;
    println!("Value: {:?}", value);

    // Delete a key
    RedisGo::delete("my_key")?;

    Ok(())
}

Structs§

RedisGo
The main Redis client wrapper providing simplified access to Redis operations.

Functions§

get_redisgo
Returns a reference to the global RedisGo singleton instance.