Skip to content

Instantly share code, notes, and snippets.

@stephenlb
stephenlb / main.rs
Last active April 30, 2026 00:49
Multi-threaded Async MPSC Cache in Tokyo
use std::collections::HashMap;
use tokio::sync::{mpsc, oneshot};
// THE BEST PART OF YOUR DAY
enum Request {
Set(String, String), // Key and Value
Get(String, oneshot::Sender<Option<String>>),
Delete(String),
}