Pool.cr

CI Documentation ISC

A simple thread-safe generic pool.

A pool can be used to store objects that are expensive to create (like connections). See here for more explanations.

Installation

Add the dependency to your shard.yml:

dependencies:
  pool:
    github: j8r/pool.cr

Documentation

https://j8r.github.io/pool.cr

Usage

require "pool"

pool = Pool.new { IO::Memory.new }
pool.get do |resource|
  # do something
end

License

Copyright (c) 2021 Julien Reichardt - ISC License