Last active
February 6, 2026 18:29
-
-
Save Narrator/8c81db5b3c7e46359107e7d605a68c95 to your computer and use it in GitHub Desktop.
Locality in rust
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Local: in-memory HashMap — fast, not resilient | |
| let sessions: HashMap<SessionId, Session> = HashMap::new(); | |
| // Server restart = all sessions lost | |
| // Distributed: Redis cluster — slower, resilient | |
| let session = redis.get(session_id).await?; | |
| // Network hop, but survives server restarts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment