Module: Typhoeus::Pool Private
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
- #clear ⇒ Object private
-
#easies ⇒ Array<Ethon::Easy>
private
Return the easy pool.
-
#get ⇒ Ethon::Easy
private
Return an easy from pool.
-
#release(easy) ⇒ Object
private
Releases easy into pool.
- #with_easy {|easy| ... } ⇒ Object private
Instance Method Details
#clear ⇒ 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.
41 42 43 |
# File 'lib/typhoeus/pool.rb', line 41 def clear easies.clear end |
#easies ⇒ 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/pool.rb', line 17 def easies @easies ||= [] end |
#get ⇒ 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/pool.rb', line 37 def get easies.pop || Ethon::Easy.new end |
#release(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/pool.rb', line 26 def release(easy) easy.reset easies << easy end |
#with_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.
45 46 47 48 49 |
# File 'lib/typhoeus/pool.rb', line 45 def with_easy(&block) easy = get yield easy release easy end |