redis-on-mysql 0.0.1

A Redis-compatible proxy that stores all data and Pub/Sub state in MySQL
Documentation
mod config;
mod handlers;
mod maintenance;
mod state;
mod storage;

use anyhow::Result;
use resp_async::Server;
use tokio::signal;

use crate::config::ProxyConfig;
use crate::handlers::build_router;
use crate::maintenance::spawn_maintenance_tasks;
use crate::state::AppState;

#[tokio::main]
async fn main() -> Result<()> {
    let config = ProxyConfig::load()?;
    let state = AppState::new(config);
    let router = build_router(state.clone());
    spawn_maintenance_tasks(state.clone());

    Server::bind(state.config.bind_addr.clone())
        .with_config(state.config.server.clone())
        .with_hooks(state.hooks())
        .with_graceful_shutdown(async {
            let _ = signal::ctrl_c().await;
        })
        .serve(router)
        .await?;

    Ok(())
}