evented-memcache-client 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +113 -0
- data/COPYING +348 -0
- data/README +75 -0
- data/Rakefile +123 -0
- data/doc/classes/EventMachine.html +146 -0
- data/doc/classes/EventMachine/Protocols.html +135 -0
- data/doc/classes/EventMachine/Protocols/Memcache.html +153 -0
- data/doc/classes/EventMachine/Protocols/Memcache/Client.html +121 -0
- data/doc/classes/EventMachine/Protocols/Memcache/Connectable.html +615 -0
- data/doc/classes/EventMachine/Protocols/Memcache/Connection.html +192 -0
- data/doc/classes/EventMachine/Protocols/Memcache/Sender.html +389 -0
- data/doc/classes/EventMachine/Protocols/Memcache/Server.html +463 -0
- data/doc/classes/EventMachine/Protocols/Memcache/TenaciousMC.html +277 -0
- data/doc/classes/MyHandler.html +197 -0
- data/doc/created.rid +1 -0
- data/doc/files/COPYING.html +473 -0
- data/doc/files/README.html +187 -0
- data/doc/files/extras/consumer_rb.html +110 -0
- data/doc/files/extras/producer_rb.html +110 -0
- data/doc/files/extras/server_rb.html +110 -0
- data/doc/files/lib/evented-memcache-client_rb.html +125 -0
- data/doc/files/lib/evented_memcache_client/client_rb.html +120 -0
- data/doc/files/lib/evented_memcache_client/connectable_rb.html +120 -0
- data/doc/files/lib/evented_memcache_client/connection_rb.html +120 -0
- data/doc/files/lib/evented_memcache_client/sender_rb.html +112 -0
- data/doc/files/lib/evented_memcache_client/server_rb.html +120 -0
- data/doc/files/lib/evented_memcache_client/tenacious_rb.html +120 -0
- data/doc/fr_class_index.html +36 -0
- data/doc/fr_file_index.html +38 -0
- data/doc/fr_method_index.html +66 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/extras/consumer.rb +41 -0
- data/extras/producer.rb +22 -0
- data/extras/server.rb +33 -0
- data/lib/evented-memcache-client.rb +37 -0
- data/lib/evented_memcache_client/client.rb +36 -0
- data/lib/evented_memcache_client/connectable.rb +324 -0
- data/lib/evented_memcache_client/connection.rb +73 -0
- data/lib/evented_memcache_client/sender.rb +184 -0
- data/lib/evented_memcache_client/server.rb +118 -0
- data/lib/evented_memcache_client/tenacious.rb +106 -0
- metadata +115 -0
@@ -0,0 +1,277 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: EventMachine::Protocols::Memcache::TenaciousMC</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">EventMachine::Protocols::Memcache::TenaciousMC</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../../files/lib/evented_memcache_client/tenacious_rb.html">
|
59
|
+
lib/evented_memcache_client/tenacious.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
<a href="Client.html">
|
69
|
+
Client
|
70
|
+
</a>
|
71
|
+
</td>
|
72
|
+
</tr>
|
73
|
+
</table>
|
74
|
+
</div>
|
75
|
+
<!-- banner header -->
|
76
|
+
|
77
|
+
<div id="bodyContent">
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<div id="contextContent">
|
82
|
+
|
83
|
+
<div id="description">
|
84
|
+
<p>
|
85
|
+
<a href="TenaciousMC.html">TenaciousMC</a> is a "tenacious"
|
86
|
+
memcache client connection. When the underlying connection is lost, it
|
87
|
+
attempts to reacquire it automatically.
|
88
|
+
</p>
|
89
|
+
|
90
|
+
</div>
|
91
|
+
|
92
|
+
|
93
|
+
</div>
|
94
|
+
|
95
|
+
<div id="method-list">
|
96
|
+
<h3 class="section-bar">Methods</h3>
|
97
|
+
|
98
|
+
<div class="name-list">
|
99
|
+
<a href="#M000026">connection_completed</a>
|
100
|
+
<a href="#M000025">new</a>
|
101
|
+
<a href="#M000027">unbind</a>
|
102
|
+
</div>
|
103
|
+
</div>
|
104
|
+
|
105
|
+
</div>
|
106
|
+
|
107
|
+
|
108
|
+
<!-- if includes -->
|
109
|
+
|
110
|
+
<div id="section">
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
<!-- if method_list -->
|
120
|
+
<div id="methods">
|
121
|
+
<h3 class="section-bar">Public Class methods</h3>
|
122
|
+
|
123
|
+
<div id="method-M000025" class="method-detail">
|
124
|
+
<a name="M000025"></a>
|
125
|
+
|
126
|
+
<div class="method-heading">
|
127
|
+
<a href="#M000025" class="method-signature">
|
128
|
+
<span class="method-name">new</span><span class="method-args">(*args)</span>
|
129
|
+
</a>
|
130
|
+
</div>
|
131
|
+
|
132
|
+
<div class="method-description">
|
133
|
+
<p>
|
134
|
+
Create a <a href="TenaciousMC.html#M000025">new</a> "tenacious"
|
135
|
+
connection, which will attempt to reacquire a connection to the server if
|
136
|
+
it is lost.
|
137
|
+
</p>
|
138
|
+
<p>
|
139
|
+
Note that when you‘re using <a
|
140
|
+
href="../../../EventMachine.html">EventMachine</a>, you won‘t be
|
141
|
+
calling TenaciousMC::new yourself - EM does it for you when a connection is
|
142
|
+
established.
|
143
|
+
</p>
|
144
|
+
<p>
|
145
|
+
First argument as per <a
|
146
|
+
href="Client.html">EventMachine::Protocols::Memcache::Client</a>. Ie.,
|
147
|
+
callback hash, module or handler object.
|
148
|
+
</p>
|
149
|
+
<p>
|
150
|
+
Second argument is hash of options governing <a
|
151
|
+
href="TenaciousMC.html">TenaciousMC</a>‘s behavior:
|
152
|
+
</p>
|
153
|
+
<pre>
|
154
|
+
{ :host => 'somewhere.com', :port=>12345, :interval => 5 }
|
155
|
+
</pre>
|
156
|
+
<p>
|
157
|
+
If the options hash includes a :eager key, and its value is true, then when
|
158
|
+
the connection opens, <a href="TenaciousMC.html">TenaciousMC</a> will
|
159
|
+
immediately send a ‘get’ to the server to fetch data, using the
|
160
|
+
value of the :key option as the key fetched.
|
161
|
+
</p>
|
162
|
+
<p>
|
163
|
+
So a typical invocation:
|
164
|
+
</p>
|
165
|
+
<pre>
|
166
|
+
EventMachine::run {
|
167
|
+
EventMachine::connect('over.there',
|
168
|
+
12345,
|
169
|
+
EventMachine::Protocols::Memcache::TenaciousMC,
|
170
|
+
MyHandlerModule,
|
171
|
+
{:host => 'over.there', :port => 12345})
|
172
|
+
}
|
173
|
+
</pre>
|
174
|
+
<p><a class="source-toggle" href="#"
|
175
|
+
onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
|
176
|
+
<div class="method-source-code" id="M000025-source">
|
177
|
+
<pre>
|
178
|
+
<span class="ruby-comment cmt"># File lib/evented_memcache_client/tenacious.rb, line 65</span>
|
179
|
+
65: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
180
|
+
66: <span class="ruby-ivar">@handle_arg</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>]
|
181
|
+
67: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">1</span>]
|
182
|
+
68: <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:host</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">'localhost'</span>
|
183
|
+
69: <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:port</span>]
|
184
|
+
70: <span class="ruby-identifier">raise</span> <span class="ruby-value str">"No port option is set"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@port</span>
|
185
|
+
71: <span class="ruby-ivar">@interval</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:interval</span>] <span class="ruby-operator">||</span> <span class="ruby-value">5</span>
|
186
|
+
72: <span class="ruby-ivar">@eager</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:eager</span>] <span class="ruby-operator">||</span> <span class="ruby-keyword kw">false</span>
|
187
|
+
73: <span class="ruby-ivar">@key</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:key</span>] <span class="ruby-operator">||</span> <span class="ruby-keyword kw">nil</span>
|
188
|
+
74: <span class="ruby-keyword kw">super</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
189
|
+
75: <span class="ruby-keyword kw">end</span>
|
190
|
+
</pre>
|
191
|
+
</div>
|
192
|
+
</div>
|
193
|
+
</div>
|
194
|
+
|
195
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
196
|
+
|
197
|
+
<div id="method-M000026" class="method-detail">
|
198
|
+
<a name="M000026"></a>
|
199
|
+
|
200
|
+
<div class="method-heading">
|
201
|
+
<a href="#M000026" class="method-signature">
|
202
|
+
<span class="method-name">connection_completed</span><span class="method-args">()</span>
|
203
|
+
</a>
|
204
|
+
</div>
|
205
|
+
|
206
|
+
<div class="method-description">
|
207
|
+
<p>
|
208
|
+
Called from EM::Connection after the connection is established.
|
209
|
+
</p>
|
210
|
+
<p><a class="source-toggle" href="#"
|
211
|
+
onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
|
212
|
+
<div class="method-source-code" id="M000026-source">
|
213
|
+
<pre>
|
214
|
+
<span class="ruby-comment cmt"># File lib/evented_memcache_client/tenacious.rb, line 78</span>
|
215
|
+
78: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">connection_completed</span>
|
216
|
+
79: <span class="ruby-keyword kw">super</span>
|
217
|
+
80: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@eager</span> <span class="ruby-operator">&&</span> <span class="ruby-ivar">@key</span>
|
218
|
+
81: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">:key</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@key</span>)
|
219
|
+
82: <span class="ruby-keyword kw">end</span>
|
220
|
+
83: <span class="ruby-keyword kw">end</span>
|
221
|
+
</pre>
|
222
|
+
</div>
|
223
|
+
</div>
|
224
|
+
</div>
|
225
|
+
|
226
|
+
<div id="method-M000027" class="method-detail">
|
227
|
+
<a name="M000027"></a>
|
228
|
+
|
229
|
+
<div class="method-heading">
|
230
|
+
<a href="#M000027" class="method-signature">
|
231
|
+
<span class="method-name">unbind</span><span class="method-args">()</span>
|
232
|
+
</a>
|
233
|
+
</div>
|
234
|
+
|
235
|
+
<div class="method-description">
|
236
|
+
<p>
|
237
|
+
Called from EM::Connection when the connection is dead.
|
238
|
+
</p>
|
239
|
+
<p><a class="source-toggle" href="#"
|
240
|
+
onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
|
241
|
+
<div class="method-source-code" id="M000027-source">
|
242
|
+
<pre>
|
243
|
+
<span class="ruby-comment cmt"># File lib/evented_memcache_client/tenacious.rb, line 86</span>
|
244
|
+
86: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unbind</span>
|
245
|
+
87: <span class="ruby-keyword kw">super</span>
|
246
|
+
88: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@interval</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
247
|
+
89: <span class="ruby-constant">EventMachine</span><span class="ruby-operator">::</span><span class="ruby-identifier">add_timer</span>(<span class="ruby-ivar">@interval</span>) <span class="ruby-keyword kw">do</span>
|
248
|
+
90: <span class="ruby-constant">EventMachine</span><span class="ruby-operator">::</span><span class="ruby-identifier">connect</span>(<span class="ruby-ivar">@host</span>,
|
249
|
+
91: <span class="ruby-ivar">@port</span>,
|
250
|
+
92: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>,
|
251
|
+
93: <span class="ruby-ivar">@handle_arg</span>,
|
252
|
+
94: {
|
253
|
+
95: <span class="ruby-identifier">:host</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@host</span>,
|
254
|
+
96: <span class="ruby-identifier">:port</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@port</span>,
|
255
|
+
97: <span class="ruby-identifier">:interval</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@interval</span>
|
256
|
+
98: })
|
257
|
+
99: <span class="ruby-keyword kw">end</span>
|
258
|
+
100: <span class="ruby-keyword kw">end</span>
|
259
|
+
101: <span class="ruby-keyword kw">end</span>
|
260
|
+
</pre>
|
261
|
+
</div>
|
262
|
+
</div>
|
263
|
+
</div>
|
264
|
+
|
265
|
+
|
266
|
+
</div>
|
267
|
+
|
268
|
+
|
269
|
+
</div>
|
270
|
+
|
271
|
+
|
272
|
+
<div id="validator-badges">
|
273
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
274
|
+
</div>
|
275
|
+
|
276
|
+
</body>
|
277
|
+
</html>
|
@@ -0,0 +1,197 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: MyHandler</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">MyHandler</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/extras/consumer_rb.html">
|
59
|
+
extras/consumer.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="method-list">
|
80
|
+
<h3 class="section-bar">Methods</h3>
|
81
|
+
|
82
|
+
<div class="name-list">
|
83
|
+
<a href="#M000002">handle_close</a>
|
84
|
+
<a href="#M000001">handle_open</a>
|
85
|
+
<a href="#M000003">handle_value</a>
|
86
|
+
</div>
|
87
|
+
</div>
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
|
92
|
+
<!-- if includes -->
|
93
|
+
|
94
|
+
<div id="section">
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
<!-- if method_list -->
|
104
|
+
<div id="methods">
|
105
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
106
|
+
|
107
|
+
<div id="method-M000002" class="method-detail">
|
108
|
+
<a name="M000002"></a>
|
109
|
+
|
110
|
+
<div class="method-heading">
|
111
|
+
<a href="#M000002" class="method-signature">
|
112
|
+
<span class="method-name">handle_close</span><span class="method-args">(conn)</span>
|
113
|
+
</a>
|
114
|
+
</div>
|
115
|
+
|
116
|
+
<div class="method-description">
|
117
|
+
<p><a class="source-toggle" href="#"
|
118
|
+
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
|
119
|
+
<div class="method-source-code" id="M000002-source">
|
120
|
+
<pre>
|
121
|
+
<span class="ruby-comment cmt"># File extras/consumer.rb, line 12</span>
|
122
|
+
12: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_close</span>(<span class="ruby-identifier">conn</span>)
|
123
|
+
13: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@opened_at</span>
|
124
|
+
14: <span class="ruby-identifier">puts</span> <span class="ruby-value str">'Lost connection to memcached.'</span>
|
125
|
+
15: <span class="ruby-keyword kw">else</span>
|
126
|
+
16: <span class="ruby-identifier">puts</span> <span class="ruby-value str">'Failed to open connection to memcached, retrying.'</span>
|
127
|
+
17: <span class="ruby-keyword kw">end</span>
|
128
|
+
18: <span class="ruby-keyword kw">end</span>
|
129
|
+
</pre>
|
130
|
+
</div>
|
131
|
+
</div>
|
132
|
+
</div>
|
133
|
+
|
134
|
+
<div id="method-M000001" class="method-detail">
|
135
|
+
<a name="M000001"></a>
|
136
|
+
|
137
|
+
<div class="method-heading">
|
138
|
+
<a href="#M000001" class="method-signature">
|
139
|
+
<span class="method-name">handle_open</span><span class="method-args">(conn)</span>
|
140
|
+
</a>
|
141
|
+
</div>
|
142
|
+
|
143
|
+
<div class="method-description">
|
144
|
+
<p><a class="source-toggle" href="#"
|
145
|
+
onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
|
146
|
+
<div class="method-source-code" id="M000001-source">
|
147
|
+
<pre>
|
148
|
+
<span class="ruby-comment cmt"># File extras/consumer.rb, line 8</span>
|
149
|
+
8: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_open</span>(<span class="ruby-identifier">conn</span>)
|
150
|
+
9: <span class="ruby-ivar">@opened_at</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
151
|
+
10: <span class="ruby-identifier">puts</span> <span class="ruby-value str">'Opened connection. Fetching...'</span>
|
152
|
+
11: <span class="ruby-keyword kw">end</span>
|
153
|
+
</pre>
|
154
|
+
</div>
|
155
|
+
</div>
|
156
|
+
</div>
|
157
|
+
|
158
|
+
<div id="method-M000003" class="method-detail">
|
159
|
+
<a name="M000003"></a>
|
160
|
+
|
161
|
+
<div class="method-heading">
|
162
|
+
<a href="#M000003" class="method-signature">
|
163
|
+
<span class="method-name">handle_value</span><span class="method-args">(conn, data, args)</span>
|
164
|
+
</a>
|
165
|
+
</div>
|
166
|
+
|
167
|
+
<div class="method-description">
|
168
|
+
<p><a class="source-toggle" href="#"
|
169
|
+
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
|
170
|
+
<div class="method-source-code" id="M000003-source">
|
171
|
+
<pre>
|
172
|
+
<span class="ruby-comment cmt"># File extras/consumer.rb, line 19</span>
|
173
|
+
19: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_value</span>(<span class="ruby-identifier">conn</span>, <span class="ruby-identifier">data</span>, <span class="ruby-identifier">args</span>)
|
174
|
+
20: <span class="ruby-identifier">key</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>]
|
175
|
+
21: <span class="ruby-identifier">flags</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">1</span>]
|
176
|
+
22: <span class="ruby-identifier">puts</span> <span class="ruby-node">"Received message: '#{data}'"</span>
|
177
|
+
23: <span class="ruby-identifier">puts</span> <span class="ruby-node">"Fetching more... #{@key}."</span>
|
178
|
+
24: <span class="ruby-identifier">conn</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">:key</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">key</span>)
|
179
|
+
25: <span class="ruby-keyword kw">end</span>
|
180
|
+
</pre>
|
181
|
+
</div>
|
182
|
+
</div>
|
183
|
+
</div>
|
184
|
+
|
185
|
+
|
186
|
+
</div>
|
187
|
+
|
188
|
+
|
189
|
+
</div>
|
190
|
+
|
191
|
+
|
192
|
+
<div id="validator-badges">
|
193
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
194
|
+
</div>
|
195
|
+
|
196
|
+
</body>
|
197
|
+
</html>
|