### Install async-pool Gem using Bundler Source: https://github.com/socketry/async-pool/blob/main/guides/getting-started/readme.md This command adds the async-pool gem to your project's Gemfile and installs it using Bundler. Ensure you have Bundler installed and configured for your project. ```bash $ bundle add async-pool ``` -------------------------------- ### Multiplex Pool Usage in Ruby Source: https://github.com/socketry/async-pool/blob/main/guides/getting-started/readme.md Illustrates the creation and usage of a multiplex connection pool. Multiplex pools allow a single resource to be used by multiple tasks concurrently. The example shows acquiring multiple resources and then releasing them. ```ruby pool = Async::Pool::Controller.wrap do # This resource can be used concurrently by up to 4 tasks: Async::Pool::Resource.new(2) end resources = 4.times.map do # Acquire a resource from the pool: pool.acquire end resources.each do |resource| # Return the resource back to the pool: pool.release(resource) end ``` -------------------------------- ### Simplex Pool Usage in Ruby Source: https://github.com/socketry/async-pool/blob/main/guides/getting-started/readme.md Demonstrates how to create and use a simplex connection pool. In simplex mode, each resource can only be used by one task at a time. Resources are automatically released when exiting the block, or manually released using `pool.release`. ```ruby pool = Async::Pool::Controller.new(Async::Pool::Resource) pool.acquire do |resource| # resource is implicitly released when exiting the block. end resource = pool.acquire # Return the resource back to the pool: pool.release(resource) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.