pool
Version, currently 0.2.16 versions
github.com/ysbaddaden/pool
Generic (connection) pools
80 stars
4 dependents
License: Apache-2.0
Nothing has been indexed for 0.2.1 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
pool:
github: ysbaddaden/pool
version: ~> 0.2.1Then run:
shards installshard.yml
No shard.yml has been indexed for 0.2.1. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
# Pool
Generic (connection) pools for Crystal
## Getting Started
A pool tailored for sharing connections across coroutines.
Connections will be checkout from the pool and tied to the current fiber, until
they are checkin, and thus be usable by another coroutine. Otherwise they behave
the same than the generic pool.
```crystal
require "pg"
require "pool/connection"
pg = ConnectionPool.new(capacity: 25, timeout: 0.01) do
PG.connect(ENV["DATABASE_URL"])
end
```
You may checkout as many connections in parallel as needed, then checkin the
connections as required:
```crystal
conn = pg.checkout
result = conn.exec("SELECT * FROM posts")
pg.checkin(conn)
```
You may checkout a single connection per coroutine. Trying to checkout another
one will always return the same single connection:
```crystal
conn = pg.connection
result = conn.exec("SELECT * FROM posts")
pg.release
```
You may also use a block, so the connection will be checkin back into the pool,
unless the connection was already checkout, in which case it will be passed to
the block, but not returned to the pool:
```crystal
pg.connection do |conn|
result = conn.exec("SELECT * FROM posts")
end
```
## License
Licensed under the Apache License, Version 2.0
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.2.1- Tagged
- Feb 8, 2023
- Commit
375f6a938c9d- Indexed
- not yet
Dependents
Repository
github.com/ysbaddaden/pool
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 12, 2026
- Synced
- Aug 12, 2026
- Versions
- 6