This is a unofficial port of Leaf.
🏠 Homepage
Enabling the mysql
and runtime-tokio
feature:
```rust
use leaves::dao::MySqlLeafDao;
use leaves::{SegmentIDGen, Config, Result};
async main() -> Result<()> { let dao = Arc::new(MySqlLeafDao::new("mysql://...").await?); let mut service = SegmentIDGen::new(dao, Config::new()); service.init().await?; let tag = 1; for _ in 0..1000 { println!("{}", service.get(tag).await?); } } ```
1,000,000 IDs in 180ms(local MongoDB with R7 3700X)