Module: Typhoeus::Hydra::EasyPool Private
- Included in:
- Typhoeus, Typhoeus::Hydra
- Defined in:
- lib/typhoeus/hydra/easy_pool.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
The easy pool stores already initialized easy handles for future use. This is useful because creating them is quite expensive.
Instance Method Summary collapse
-
#easy_pool ⇒ Array<Ethon::Easy>
private
Return the easy pool.
-
#get_easy ⇒ Ethon::Easy
private
Return an easy from pool.
-
#release_easy(easy) ⇒ Object
private
Releases easy into pool.
Instance Method Details
#easy_pool ⇒ Array<Ethon::Easy>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return the easy pool.
17 18 19 |
# File 'lib/typhoeus/hydra/easy_pool.rb', line 17 def easy_pool @easy_pool ||= [] end |
#get_easy ⇒ Ethon::Easy
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return an easy from pool.
37 38 39 |
# File 'lib/typhoeus/hydra/easy_pool.rb', line 37 def get_easy easy_pool.pop || Ethon::Easy.new end |
#release_easy(easy) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Releases easy into pool. The easy handle is resetted before it gets back in.
26 27 28 29 |
# File 'lib/typhoeus/hydra/easy_pool.rb', line 26 def release_easy(easy) easy.reset easy_pool << easy end |