freshness v0.3.0 Freshness.Pool View Source
A simple pool backed by a :queue to store connections
Usage
To create a pool call the new/4 function
pool = Freshness.Pool.new(:http, "google.com", 80)
To checkout a connection from the pool use the checkout/1 function. Note: if there are no connections in the pool a new one will be created and returned
{:ok, pool, connection} = Freshness.Pool.checkout(pool)
You may also get an error if there are no connections in the pool and a new connection cannot be opened
{:error, error} = Freshness.Pool.checkout(pool)
To return a connection back to the pool use the checkin/2 function
pool = Freshness.Pool.checkin(pool, connection)
Link to this section Summary
Link to this section Types
Link to this section Functions
Link to this function
checkout(pool)
View Sourcecheckout(t()) :: {:ok, t(), Mint.HTTP.t()} | {:error, Mint.Types.error()}
Link to this function
new(scheme, host, port, opts \\ [])
View Sourcenew(Mint.Types.scheme(), String.t(), :inet.port_number(), keyword()) :: t()