11 releases
0.5.0 | Feb 3, 2024 |
---|---|
0.4.0 | Aug 29, 2022 |
0.3.3 | Mar 18, 2022 |
0.2.3 | Jul 8, 2021 |
0.1.0 | Jun 8, 2021 |
#57 in Caching
1,460 downloads per month
43KB
862 lines
Lease
This crate provides a Pool
struct that allows taking Lease
es and using them.
When a Lease
is dropped it is automatically returned to the pool.
One nice thing about this api is that the lifetime of a Lease
is not connected to the lifetime
of a Pool
so they can be sent across threads.
There is also an InitPool
that ensures that all new leases are created the same way
A LockedPool
only allows calling functions that do not add or remove any Lease
s
Features
async
- Enables the [
Pool::get()
] function. Async brings a little bit of overhead to getting leases so it is behind a feature. - Enables the [
Pool::stream()
] function that allows getting a stream of leases as they become available
- Enables the [
lib.rs
:
Lease
This crate provides a Pool
struct that allows taking Lease
es and using them.
When a Lease
is dropped it is automatically returned to the pool.
One nice thing about this api is that the lifetime of a Lease
is not connected to the lifetime
of a Pool
so they can be sent across threads.
There is also an InitPool
that ensures that all new leases are created the same way
A LockedPool
only allows calling functions that do not add or remove any Lease
s
Features
async
- Enables the [
Pool::get()
] function. Async brings a little bit of overhead to getting leases so it is behind a feature. - Enables the [
Pool::stream()
] function that allows getting a stream of leases as they become available
- Enables the [
Dependencies
~0.7–5.5MB
~17K SLoC