connpool - a concurrent, generic connection pool for Rust
connpool is a high-performance, generic connection pool crate designed for Rust applications.
It provides a thread-safe, asynchronous pool for managing and reusing connections (or any other resource)
with both global and local (per-key) limits.
Features
- Concurrent access - uses
ArcandRwLockfor thread-safe operations. - Global and local limits - enforce both global pool limits and per-key local limits using semaphores.
- Asynchronous - supports async Rust.
- Automatic eviction - automatically evicts items when the pool is full.
- Flexible key/value types - works with any key/value types that implement
Eq + Hash. - Unbounded mode - option to create a pool without a global limit.
Usage
use Pool;
async
Advanced usage
- Local limits - set per-key limits to restrict the number of concurrent connections for specific keys.
- Manual management - use
pull_with_local_limitfor fine-grained control over local limits.
License
This project is licensed under the MIT License.