The easy pool stores already initialized easy handles for future use. This is useful because creating them is quite expensive.
@api private
# File lib/typhoeus/pool.rb, line 35 def clear @mutex.synchronize { easies.clear } end
Return an easy from pool.
@example Return easy.
hydra.get_easy
@return [ Ethon::Easy ] The easy.
# File lib/typhoeus/pool.rb, line 31 def get @mutex.synchronize { easies.pop } || Ethon::Easy.new end
Releases easy into pool. The easy handle is resetted before it gets back in.
@example Release easy.
hydra.release_easy(easy)
# File lib/typhoeus/pool.rb, line 20 def release(easy) easy.reset @mutex.synchronize { easies << easy } end
# File lib/typhoeus/pool.rb, line 39 def with_easy(&block) easy = get yield easy ensure release(easy) if easy end
Return the easy pool.
@example Return easy pool.
hydra.easy_pool
@return [ Array<Ethon::Easy> ] The easy pool.
# File lib/typhoeus/pool.rb, line 54 def easies @easies ||= [] end