#authorization #security #web

sa-token-storage-memory

In-memory storage implementation for sa-token-rust

13 releases

Uses new Rust 2024

new 0.1.12 Dec 17, 2025
0.1.11 Nov 22, 2025
0.1.4 Oct 15, 2025

#1281 in Authentication

Download history 500/week @ 2025-10-11 119/week @ 2025-10-18 31/week @ 2025-10-25 11/week @ 2025-11-01 45/week @ 2025-11-08 67/week @ 2025-11-15 36/week @ 2025-11-22 14/week @ 2025-11-29 24/week @ 2025-12-06

165 downloads per month
Used in 11 crates

MIT/Apache

29KB
401 lines

sa-token-storage-memory

In-memory storage implementation for sa-token-rust.

Features

  • High Performance: Ultra-fast in-memory storage
  • 🎯 Zero Configuration: Works out of the box
  • 🧪 Perfect for Development: Quick setup for testing
  • 💾 TTL Support: Automatic expiration handling

Installation

[dependencies]
sa-token-storage-memory = "0.1.2"

Usage

use sa_token_storage_memory::MemoryStorage;
use sa_token_plugin_axum::SaTokenState;
use std::sync::Arc;

let storage = Arc::new(MemoryStorage::new());

let state = SaTokenState::builder()
    .storage(storage)
    .timeout(7200)
    .build();

⚠️ Important Notes

  • Not for Production: Data is lost on restart
  • Single Instance: Does not work across multiple servers
  • Memory Limited: Suitable for development and testing only

For production environments, use sa-token-storage-redis instead.

Author

金书记

License

Licensed under either of Apache-2.0 or MIT.

Dependencies

~6–12MB
~205K SLoC