Crates.io | random-pool |
lib.rs | random-pool |
version | 0.1.1 |
source | src |
created_at | 2017-11-16 01:16:51.295883 |
updated_at | 2017-11-16 12:41:34.720164 |
description | A threadsafe, fixed size, pool, where its contents are individually guarded by Mutexes. |
homepage | https://github.com/hgzimmerman/random-pool |
repository | https://github.com/hgzimmerman/random-pool |
max_upload_size | |
id | 39511 |
size | 14,072 |
A threadsafe, fixed-size, persistent object pool, where its contents are individually guarded by Mutexes and are guaranteed to be accessed randomly.
This crate is useful for situations where you need a fixed number of mutable elements that can be shared across threads, but the particular element you are accessing is not important.
This is useful either when you want a pool of identical resources that you don't intend to modify, like DB connections, or when you want a set of resources that when accessed randomly, will trend towards having the same contents, like a dynamic cache.
Arc
.get()
),
or to return None if all elements are currently locked ( try_get()
).