evented-memcache-client 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,153 @@
|
|
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: EventMachine::Protocols::Memcache</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">EventMachine::Protocols::Memcache</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_rb.html">
|
59
|
+
lib/evented-memcache-client.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
<a href="../../../files/lib/evented_memcache_client/client_rb.html">
|
63
|
+
lib/evented_memcache_client/client.rb
|
64
|
+
</a>
|
65
|
+
<br />
|
66
|
+
<a href="../../../files/lib/evented_memcache_client/connectable_rb.html">
|
67
|
+
lib/evented_memcache_client/connectable.rb
|
68
|
+
</a>
|
69
|
+
<br />
|
70
|
+
<a href="../../../files/lib/evented_memcache_client/connection_rb.html">
|
71
|
+
lib/evented_memcache_client/connection.rb
|
72
|
+
</a>
|
73
|
+
<br />
|
74
|
+
<a href="../../../files/lib/evented_memcache_client/sender_rb.html">
|
75
|
+
lib/evented_memcache_client/sender.rb
|
76
|
+
</a>
|
77
|
+
<br />
|
78
|
+
<a href="../../../files/lib/evented_memcache_client/server_rb.html">
|
79
|
+
lib/evented_memcache_client/server.rb
|
80
|
+
</a>
|
81
|
+
<br />
|
82
|
+
<a href="../../../files/lib/evented_memcache_client/tenacious_rb.html">
|
83
|
+
lib/evented_memcache_client/tenacious.rb
|
84
|
+
</a>
|
85
|
+
<br />
|
86
|
+
</td>
|
87
|
+
</tr>
|
88
|
+
|
89
|
+
</table>
|
90
|
+
</div>
|
91
|
+
<!-- banner header -->
|
92
|
+
|
93
|
+
<div id="bodyContent">
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
<div id="contextContent">
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
</div>
|
102
|
+
|
103
|
+
|
104
|
+
</div>
|
105
|
+
|
106
|
+
|
107
|
+
<!-- if includes -->
|
108
|
+
|
109
|
+
<div id="section">
|
110
|
+
|
111
|
+
<div id="class-list">
|
112
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
113
|
+
|
114
|
+
Module <a href="Memcache/Connectable.html" class="link">EventMachine::Protocols::Memcache::Connectable</a><br />
|
115
|
+
Module <a href="Memcache/Sender.html" class="link">EventMachine::Protocols::Memcache::Sender</a><br />
|
116
|
+
Class <a href="Memcache/Client.html" class="link">EventMachine::Protocols::Memcache::Client</a><br />
|
117
|
+
Class <a href="Memcache/Connection.html" class="link">EventMachine::Protocols::Memcache::Connection</a><br />
|
118
|
+
Class <a href="Memcache/Server.html" class="link">EventMachine::Protocols::Memcache::Server</a><br />
|
119
|
+
Class <a href="Memcache/TenaciousMC.html" class="link">EventMachine::Protocols::Memcache::TenaciousMC</a><br />
|
120
|
+
|
121
|
+
</div>
|
122
|
+
|
123
|
+
<div id="constants-list">
|
124
|
+
<h3 class="section-bar">Constants</h3>
|
125
|
+
|
126
|
+
<div class="name-list">
|
127
|
+
<table summary="Constants">
|
128
|
+
<tr class="top-aligned-row context-row">
|
129
|
+
<td class="context-item-name">VERSION</td>
|
130
|
+
<td>=</td>
|
131
|
+
<td class="context-item-value">"1.0.0"</td>
|
132
|
+
</tr>
|
133
|
+
</table>
|
134
|
+
</div>
|
135
|
+
</div>
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
<!-- if method_list -->
|
143
|
+
|
144
|
+
|
145
|
+
</div>
|
146
|
+
|
147
|
+
|
148
|
+
<div id="validator-badges">
|
149
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
150
|
+
</div>
|
151
|
+
|
152
|
+
</body>
|
153
|
+
</html>
|
@@ -0,0 +1,121 @@
|
|
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::Client</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::Client</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/client_rb.html">
|
59
|
+
lib/evented_memcache_client/client.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="Connection.html">
|
69
|
+
Connection
|
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 functional (though simple) client-side implementation of the memcache
|
86
|
+
protocol for <a href="../../../EventMachine.html">EventMachine</a>-based
|
87
|
+
systems. See extras/producer.rb and extras/consumer.rb for examples.
|
88
|
+
</p>
|
89
|
+
|
90
|
+
</div>
|
91
|
+
|
92
|
+
|
93
|
+
</div>
|
94
|
+
|
95
|
+
|
96
|
+
</div>
|
97
|
+
|
98
|
+
|
99
|
+
<!-- if includes -->
|
100
|
+
|
101
|
+
<div id="section">
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
<!-- if method_list -->
|
111
|
+
|
112
|
+
|
113
|
+
</div>
|
114
|
+
|
115
|
+
|
116
|
+
<div id="validator-badges">
|
117
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
118
|
+
</div>
|
119
|
+
|
120
|
+
</body>
|
121
|
+
</html>
|
@@ -0,0 +1,615 @@
|
|
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: EventMachine::Protocols::Memcache::Connectable</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">EventMachine::Protocols::Memcache::Connectable</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/connectable_rb.html">
|
59
|
+
lib/evented_memcache_client/connectable.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
|
+
<div id="description">
|
76
|
+
<p>
|
77
|
+
Included by <a href="Connection.html">Connection</a> to implement the
|
78
|
+
interface to EventMachine::Connection; handles the opening/closing of the
|
79
|
+
connection, and when data is received from the remote endpoint. Parses
|
80
|
+
messages and delivers callbacks to higher level application code.
|
81
|
+
</p>
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
<div id="method-list">
|
89
|
+
<h3 class="section-bar">Methods</h3>
|
90
|
+
|
91
|
+
<div class="name-list">
|
92
|
+
<a href="#M000006">connection_completed</a>
|
93
|
+
<a href="#M000015">handle</a>
|
94
|
+
<a href="#M000014">io_per_sec</a>
|
95
|
+
<a href="#M000010">parse_header</a>
|
96
|
+
<a href="#M000009">parse_incoming_data</a>
|
97
|
+
<a href="#M000005">post_init</a>
|
98
|
+
<a href="#M000007">receive_data</a>
|
99
|
+
<a href="#M000011">receive_message</a>
|
100
|
+
<a href="#M000016">remote_endpoint</a>
|
101
|
+
<a href="#M000004">set_handler</a>
|
102
|
+
<a href="#M000013">start_closing</a>
|
103
|
+
<a href="#M000012">to_s</a>
|
104
|
+
<a href="#M000008">unbind</a>
|
105
|
+
</div>
|
106
|
+
</div>
|
107
|
+
|
108
|
+
</div>
|
109
|
+
|
110
|
+
|
111
|
+
<!-- if includes -->
|
112
|
+
<div id="includes">
|
113
|
+
<h3 class="section-bar">Included Modules</h3>
|
114
|
+
|
115
|
+
<div id="includes-list">
|
116
|
+
<span class="include-name"><a href="Sender.html">Sender</a></span>
|
117
|
+
</div>
|
118
|
+
</div>
|
119
|
+
|
120
|
+
<div id="section">
|
121
|
+
|
122
|
+
|
123
|
+
<div id="constants-list">
|
124
|
+
<h3 class="section-bar">Constants</h3>
|
125
|
+
|
126
|
+
<div class="name-list">
|
127
|
+
<table summary="Constants">
|
128
|
+
<tr class="top-aligned-row context-row">
|
129
|
+
<td class="context-item-name">HEADER_REGEX</td>
|
130
|
+
<td>=</td>
|
131
|
+
<td class="context-item-value">/([^\r\n]+?)\r\n/m</td>
|
132
|
+
</tr>
|
133
|
+
<tr class="top-aligned-row context-row">
|
134
|
+
<td class="context-item-name">NO_ARG_MESSAGES</td>
|
135
|
+
<td>=</td>
|
136
|
+
<td class="context-item-value">[ 'error', 'stored', 'not_stored', 'exists', 'not_found', 'end', 'deleted', 'ok', ]</td>
|
137
|
+
</tr>
|
138
|
+
<tr class="top-aligned-row context-row">
|
139
|
+
<td class="context-item-name">ARG_MESSAGES</td>
|
140
|
+
<td>=</td>
|
141
|
+
<td class="context-item-value">[ 'client_error', 'server_error', 'stat', 'version', 'get', 'gets', ]</td>
|
142
|
+
</tr>
|
143
|
+
<tr class="top-aligned-row context-row">
|
144
|
+
<td class="context-item-name">BODY_MESSAGES</td>
|
145
|
+
<td>=</td>
|
146
|
+
<td class="context-item-value">[]</td>
|
147
|
+
</tr>
|
148
|
+
<tr class="top-aligned-row context-row">
|
149
|
+
<td class="context-item-name">ARG_AND_BODY_MESSAGES</td>
|
150
|
+
<td>=</td>
|
151
|
+
<td class="context-item-value">['reserved']</td>
|
152
|
+
</tr>
|
153
|
+
<tr class="top-aligned-row context-row">
|
154
|
+
<td class="context-item-name">ARGS_AND_BODY_MESSAGES</td>
|
155
|
+
<td>=</td>
|
156
|
+
<td class="context-item-value">[ 'value', 'set', 'add', 'replace', 'append', 'prepend', ]</td>
|
157
|
+
</tr>
|
158
|
+
<tr class="top-aligned-row context-row">
|
159
|
+
<td class="context-item-name">ALL_MESSAGES</td>
|
160
|
+
<td>=</td>
|
161
|
+
<td class="context-item-value">NO_ARG_MESSAGES + ARG_MESSAGES + BODY_MESSAGES + ARG_AND_BODY_MESSAGES + ARGS_AND_BODY_MESSAGES</td>
|
162
|
+
</tr>
|
163
|
+
</table>
|
164
|
+
</div>
|
165
|
+
</div>
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
<!-- if method_list -->
|
173
|
+
<div id="methods">
|
174
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
175
|
+
|
176
|
+
<div id="method-M000006" class="method-detail">
|
177
|
+
<a name="M000006"></a>
|
178
|
+
|
179
|
+
<div class="method-heading">
|
180
|
+
<a href="#M000006" class="method-signature">
|
181
|
+
<span class="method-name">connection_completed</span><span class="method-args">()</span>
|
182
|
+
</a>
|
183
|
+
</div>
|
184
|
+
|
185
|
+
<div class="method-description">
|
186
|
+
<p>
|
187
|
+
Called after connection established. NB: not called for passive (server)
|
188
|
+
connections
|
189
|
+
</p>
|
190
|
+
<p><a class="source-toggle" href="#"
|
191
|
+
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
192
|
+
<div class="method-source-code" id="M000006-source">
|
193
|
+
<pre>
|
194
|
+
<span class="ruby-comment cmt"># File lib/evented_memcache_client/connectable.rb, line 91</span>
|
195
|
+
91: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">connection_completed</span>
|
196
|
+
92: <span class="ruby-ivar">@opened_at</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
197
|
+
93: <span class="ruby-identifier">handle</span>(<span class="ruby-identifier">:open</span>, <span class="ruby-keyword kw">self</span>)
|
198
|
+
94: <span class="ruby-keyword kw">end</span>
|
199
|
+
</pre>
|
200
|
+
</div>
|
201
|
+
</div>
|
202
|
+
</div>
|
203
|
+
|
204
|
+
<div id="method-M000015" class="method-detail">
|
205
|
+
<a name="M000015"></a>
|
206
|
+
|
207
|
+
<div class="method-heading">
|
208
|
+
<a href="#M000015" class="method-signature">
|
209
|
+
<span class="method-name">handle</span><span class="method-args">(*args)</span>
|
210
|
+
</a>
|
211
|
+
</div>
|
212
|
+
|
213
|
+
<div class="method-description">
|
214
|
+
<p>
|
215
|
+
Call the user-supplied callback method for the message we got.
|
216
|
+
</p>
|
217
|
+
<p><a class="source-toggle" href="#"
|
218
|
+
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
219
|
+
<div class="method-source-code" id="M000015-source">
|
220
|
+
<pre>
|
221
|
+
<span class="ruby-comment cmt"># File lib/evented_memcache_client/connectable.rb, line 303</span>
|
222
|
+
303: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
223
|
+
304: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@callbacks</span>[<span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>]]
|
224
|
+
305: <span class="ruby-ivar">@callbacks</span>[<span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>]].<span class="ruby-identifier">call</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>])
|
225
|
+
306: <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@handler</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>])
|
226
|
+
307: <span class="ruby-ivar">@handler</span>.<span class="ruby-identifier">send</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
227
|
+
308: <span class="ruby-keyword kw">elsif</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-node">"handle_#{args[0]}"</span>.<span class="ruby-identifier">to_sym</span>)
|
228
|
+
309: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">"handle_#{args[0]}"</span>.<span class="ruby-identifier">to_sym</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>])
|
229
|
+
310: <span class="ruby-keyword kw">end</span>
|
230
|
+
311: <span class="ruby-keyword kw">end</span>
|
231
|
+
</pre>
|
232
|
+
</div>
|
233
|
+
</div>
|
234
|
+
</div>
|
235
|
+
|
236
|
+
<div id="method-M000014" class="method-detail">
|
237
|
+
<a name="M000014"></a>
|
238
|
+
|
239
|
+
<div class="method-heading">
|
240
|
+
<a href="#M000014" class="method-signature">
|
241
|
+
<span class="method-name">io_per_sec</span><span class="method-args">()</span>
|
242
|
+
</a>
|
243
|
+
</div>
|
244
|
+
|
245
|
+
<div class="method-description">
|
246
|
+
<p>
|
247
|
+
How fast did we go? Returns a float.
|
248
|
+
</p>
|
249
|
+
<p><a class="source-toggle" href="#"
|
250
|
+
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
251
|
+
<div class="method-source-code" id="M000014-source">
|
252
|
+
<pre>
|
253
|
+
<span class="ruby-comment cmt"># File lib/evented_memcache_client/connectable.rb, line 297</span>
|
254
|
+
297: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">io_per_sec</span>
|
255
|
+
298: <span class="ruby-identifier">total</span> = <span class="ruby-ivar">@msgs_in</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@msgs_out</span>
|
256
|
+
299: (<span class="ruby-identifier">total</span> <span class="ruby-operator">/</span> ((<span class="ruby-ivar">@closed_at</span> <span class="ruby-operator">||</span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>) <span class="ruby-operator">-</span> <span class="ruby-ivar">@opened_at</span>)).<span class="ruby-identifier">to_f</span>
|
257
|
+
300: <span class="ruby-keyword kw">end</span>
|
258
|
+
</pre>
|
259
|
+
</div>
|
260
|
+
</div>
|
261
|
+
</div>
|
262
|
+
|
263
|
+
<div id="method-M000010" class="method-detail">
|
264
|
+
<a name="M000010"></a>
|
265
|
+
|
266
|
+
<div class="method-heading">
|
267
|
+
<a href="#M000010" class="method-signature">
|
268
|
+
<span class="method-name">parse_header</span><span class="method-args">(header_data)</span>
|
269
|
+
</a>
|
270
|
+
</div>
|
271
|
+
|
272
|
+
<div class="method-description">
|
273
|
+
<p>
|
274
|
+
Figure out what the header is, and call the appropriate parsing command.
|
275
|
+
</p>
|
276
|
+
<p><a class="source-toggle" href="#"
|
277
|
+
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
278
|
+
<div class="method-source-code" id="M000010-source">
|
279
|
+
<pre>
|
280
|
+
<span class="ruby-comment cmt"># File lib/evented_memcache_client/connectable.rb, line 130</span>
|
281
|
+
130: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_header</span>(<span class="ruby-identifier">header_data</span>)
|
282
|
+
131: <span class="ruby-identifier">elements</span> = <span class="ruby-identifier">header_data</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/\s/</span>)
|
283
|
+
132: <span class="ruby-identifier">command_name</span> = <span class="ruby-identifier">elements</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">downcase</span>
|
284
|
+
133: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-node">"parse_#{command_name}"</span>)
|
285
|
+
134: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">"parse_#{command_name}"</span>, <span class="ruby-identifier">elements</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>])
|
286
|
+
135: <span class="ruby-keyword kw">else</span>
|
287
|
+
136: <span class="ruby-identifier">handle</span>(<span class="ruby-identifier">:unknown_message</span>, <span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">command_name</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-keyword kw">nil</span>)
|
288
|
+
137: <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">0</span>, <span class="ruby-ivar">@scanner</span>.<span class="ruby-identifier">pos</span>)
|
289
|
+
138: <span class="ruby-keyword kw">end</span>
|
290
|
+
139: <span class="ruby-keyword kw">end</span>
|
291
|
+
</pre>
|
292
|
+
</div>
|
293
|
+
</div>
|
294
|
+
</div>
|
295
|
+
|
296
|
+
<div id="method-M000009" class="method-detail">
|
297
|
+
<a name="M000009"></a>
|
298
|
+
|
299
|
+
<div class="method-heading">
|
300
|
+
<a href="#M000009" class="method-signature">
|
301
|
+
<span class="method-name">parse_incoming_data</span><span class="method-args">()</span>
|
302
|
+
</a>
|
303
|
+
</div>
|
304
|
+
|
305
|
+
<div class="method-description">
|
306
|
+
<p>
|
307
|
+
See if we can pull a header out of the incoming data buffer
|
308
|
+
</p>
|
309
|
+
<p><a class="source-toggle" href="#"
|
310
|
+
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
311
|
+
<div class="method-source-code" id="M000009-source">
|
312
|
+
<pre>
|
313
|
+
<span class="ruby-comment cmt"># File lib/evented_memcache_client/connectable.rb, line 115</span>
|
314
|
+
115: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_incoming_data</span>
|
315
|
+
116: <span class="ruby-ivar">@scanner</span> = <span class="ruby-constant">StringScanner</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@data</span>)
|
316
|
+
117: <span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">header</span> = <span class="ruby-ivar">@scanner</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-constant">HEADER_REGEX</span>)) <span class="ruby-keyword kw">do</span>
|
317
|
+
118: <span class="ruby-identifier">len</span> = <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">length</span>
|
318
|
+
119: <span class="ruby-identifier">parse_header</span>(<span class="ruby-identifier">header</span>)
|
319
|
+
120: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">len</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">length</span>
|
320
|
+
121: <span class="ruby-keyword kw">break</span> <span class="ruby-comment cmt"># it didn't take anything out, so there's not enough</span>
|
321
|
+
122: <span class="ruby-keyword kw">end</span>
|
322
|
+
123: <span class="ruby-ivar">@msgs_in</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
323
|
+
124: <span class="ruby-ivar">@scanner</span> = <span class="ruby-constant">StringScanner</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@data</span>)
|
324
|
+
125: <span class="ruby-keyword kw">end</span>
|
325
|
+
126: <span class="ruby-keyword kw">end</span>
|
326
|
+
</pre>
|
327
|
+
</div>
|
328
|
+
</div>
|
329
|
+
</div>
|
330
|
+
|
331
|
+
<div id="method-M000005" class="method-detail">
|
332
|
+
<a name="M000005"></a>
|
333
|
+
|
334
|
+
<div class="method-heading">
|
335
|
+
<a href="#M000005" class="method-signature">
|
336
|
+
<span class="method-name">post_init</span><span class="method-args">()</span>
|
337
|
+
</a>
|
338
|
+
</div>
|
339
|
+
|
340
|
+
<div class="method-description">
|
341
|
+
<p>
|
342
|
+
Called first(?) reactor spin after instantiated.
|
343
|
+
</p>
|
344
|
+
<p><a class="source-toggle" href="#"
|
345
|
+
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
346
|
+
<div class="method-source-code" id="M000005-source">
|
347
|
+
<pre>
|
348
|
+
<span class="ruby-comment cmt"># File lib/evented_memcache_client/connectable.rb, line 75</span>
|
349
|
+
75: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">post_init</span>
|
350
|
+
76: <span class="ruby-ivar">@data</span> = <span class="ruby-value str">""</span>
|
351
|
+
77:
|
352
|
+
78: <span class="ruby-comment cmt"># Stats</span>
|
353
|
+
79:
|
354
|
+
80: <span class="ruby-ivar">@rcvs</span> = <span class="ruby-value">0</span>
|
355
|
+
81: <span class="ruby-ivar">@msgs_in</span> = <span class="ruby-value">0</span>
|
356
|
+
82: <span class="ruby-ivar">@msgs_out</span> = <span class="ruby-value">0</span>
|
357
|
+
83: <span class="ruby-ivar">@rcv_stats</span> = {}
|
358
|
+
84: <span class="ruby-ivar">@snd_stats</span> = {}
|
359
|
+
85: <span class="ruby-ivar">@opened_at</span> = <span class="ruby-keyword kw">nil</span>
|
360
|
+
86: <span class="ruby-ivar">@closed_at</span> = <span class="ruby-keyword kw">nil</span>
|
361
|
+
87: <span class="ruby-keyword kw">end</span>
|
362
|
+
</pre>
|
363
|
+
</div>
|
364
|
+
</div>
|
365
|
+
</div>
|
366
|
+
|
367
|
+
<div id="method-M000007" class="method-detail">
|
368
|
+
<a name="M000007"></a>
|
369
|
+
|
370
|
+
<div class="method-heading">
|
371
|
+
<a href="#M000007" class="method-signature">
|
372
|
+
<span class="method-name">receive_data</span><span class="method-args">(data)</span>
|
373
|
+
</a>
|
374
|
+
</div>
|
375
|
+
|
376
|
+
<div class="method-description">
|
377
|
+
<p>
|
378
|
+
Called from EM::Connection when we have data
|
379
|
+
</p>
|
380
|
+
<p><a class="source-toggle" href="#"
|
381
|
+
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
382
|
+
<div class="method-source-code" id="M000007-source">
|
383
|
+
<pre>
|
384
|
+
<span class="ruby-comment cmt"># File lib/evented_memcache_client/connectable.rb, line 97</span>
|
385
|
+
97: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">receive_data</span>(<span class="ruby-identifier">data</span>)
|
386
|
+
98: <span class="ruby-ivar">@rcvs</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
387
|
+
99: <span class="ruby-ivar">@data</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">data</span>
|
388
|
+
100: <span class="ruby-identifier">parse_incoming_data</span>
|
389
|
+
101: <span class="ruby-keyword kw">end</span>
|
390
|
+
</pre>
|
391
|
+
</div>
|
392
|
+
</div>
|
393
|
+
</div>
|
394
|
+
|
395
|
+
<div id="method-M000011" class="method-detail">
|
396
|
+
<a name="M000011"></a>
|
397
|
+
|
398
|
+
<div class="method-heading">
|
399
|
+
<a href="#M000011" class="method-signature">
|
400
|
+
<span class="method-name">receive_message</span><span class="method-args">(message_name, data, args=nil)</span>
|
401
|
+
</a>
|
402
|
+
</div>
|
403
|
+
|
404
|
+
<div class="method-description">
|
405
|
+
<p>
|
406
|
+
Generic "You‘ve got mail"… Pass it off to the
|
407
|
+
specific handler method.
|
408
|
+
</p>
|
409
|
+
<p><a class="source-toggle" href="#"
|
410
|
+
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
411
|
+
<div class="method-source-code" id="M000011-source">
|
412
|
+
<pre>
|
413
|
+
<span class="ruby-comment cmt"># File lib/evented_memcache_client/connectable.rb, line 247</span>
|
414
|
+
247: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">receive_message</span>(<span class="ruby-identifier">message_name</span>, <span class="ruby-identifier">data</span>, <span class="ruby-identifier">args</span>=<span class="ruby-keyword kw">nil</span>)
|
415
|
+
248: <span class="ruby-ivar">@rcv_stats</span>[<span class="ruby-identifier">message_name</span>] <span class="ruby-operator">||=</span> <span class="ruby-value">0</span>
|
416
|
+
249: <span class="ruby-ivar">@rcv_stats</span>[<span class="ruby-identifier">message_name</span>] <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
417
|
+
250: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-node">"receive_#{message_name}"</span>)
|
418
|
+
251: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">"receive_#{message_name}"</span>, <span class="ruby-identifier">data</span>, <span class="ruby-identifier">args</span>)
|
419
|
+
252: <span class="ruby-keyword kw">else</span>
|
420
|
+
253: <span class="ruby-identifier">handle</span>(<span class="ruby-identifier">:unknown_message</span>, <span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">message_name</span>, <span class="ruby-identifier">data</span>, <span class="ruby-identifier">args</span>)
|
421
|
+
254: <span class="ruby-keyword kw">end</span>
|
422
|
+
255: <span class="ruby-keyword kw">end</span>
|
423
|
+
</pre>
|
424
|
+
</div>
|
425
|
+
</div>
|
426
|
+
</div>
|
427
|
+
|
428
|
+
<div id="method-M000016" class="method-detail">
|
429
|
+
<a name="M000016"></a>
|
430
|
+
|
431
|
+
<div class="method-heading">
|
432
|
+
<a href="#M000016" class="method-signature">
|
433
|
+
<span class="method-name">remote_endpoint</span><span class="method-args">()</span>
|
434
|
+
</a>
|
435
|
+
</div>
|
436
|
+
|
437
|
+
<div class="method-description">
|
438
|
+
<p>
|
439
|
+
Returns a nice string showing something like "192.168.1.1:32122"
|
440
|
+
</p>
|
441
|
+
<p><a class="source-toggle" href="#"
|
442
|
+
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
443
|
+
<div class="method-source-code" id="M000016-source">
|
444
|
+
<pre>
|
445
|
+
<span class="ruby-comment cmt"># File lib/evented_memcache_client/connectable.rb, line 314</span>
|
446
|
+
314: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remote_endpoint</span>
|
447
|
+
315: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@peer</span> <span class="ruby-operator">&&</span> (<span class="ruby-identifier">peername</span> = <span class="ruby-identifier">get_peername</span>)
|
448
|
+
316: <span class="ruby-ivar">@peer</span> = <span class="ruby-constant">Socket</span>.<span class="ruby-identifier">unpack_sockaddr_in</span>(<span class="ruby-identifier">peername</span>)
|
449
|
+
317: <span class="ruby-keyword kw">end</span>
|
450
|
+
318: <span class="ruby-ivar">@peer</span> <span class="ruby-operator">?</span> <span class="ruby-node">"#{@peer[1]}:#{@peer[0]}"</span> <span class="ruby-operator">:</span> <span class="ruby-value str">'?:?'</span>
|
451
|
+
319: <span class="ruby-keyword kw">end</span>
|
452
|
+
</pre>
|
453
|
+
</div>
|
454
|
+
</div>
|
455
|
+
</div>
|
456
|
+
|
457
|
+
<div id="method-M000004" class="method-detail">
|
458
|
+
<a name="M000004"></a>
|
459
|
+
|
460
|
+
<div class="method-heading">
|
461
|
+
<a href="#M000004" class="method-signature">
|
462
|
+
<span class="method-name">set_handler</span><span class="method-args">(handler)</span>
|
463
|
+
</a>
|
464
|
+
</div>
|
465
|
+
|
466
|
+
<div class="method-description">
|
467
|
+
<p>
|
468
|
+
Install callbacks.
|
469
|
+
</p>
|
470
|
+
<p>
|
471
|
+
<tt>handler</tt> may be a Hash of Procs, a Module, or an object. If
|
472
|
+
it‘s a hash of Procs, each key is a callback like :open, :close,
|
473
|
+
:unknown_message, and :foo, where foo is a memcache protocol message (eg,
|
474
|
+
:stored).
|
475
|
+
</p>
|
476
|
+
<p>
|
477
|
+
If <tt>handler</tt> is a Module, it is assumed that it defines a number of
|
478
|
+
methods like handle_open, handle_close, and handle_foo, where foo is a is a
|
479
|
+
memcache protocol message (eg, handle_stored). <tt>handler</tt> is then
|
480
|
+
<tt>include</tt>‘d, making its methods available as callbacks.
|
481
|
+
</p>
|
482
|
+
<p>
|
483
|
+
If <tt>handler</tt> is an object, <a
|
484
|
+
href="Connectable.html">Connectable</a> will invoke methods on it
|
485
|
+
corresponding to the abovementioned. Eg., :open, :closed, :unknown_message,
|
486
|
+
and :<memcache_message>, like :stored, :value, :end, etc.
|
487
|
+
</p>
|
488
|
+
<p><a class="source-toggle" href="#"
|
489
|
+
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
490
|
+
<div class="method-source-code" id="M000004-source">
|
491
|
+
<pre>
|
492
|
+
<span class="ruby-comment cmt"># File lib/evented_memcache_client/connectable.rb, line 60</span>
|
493
|
+
60: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_handler</span>(<span class="ruby-identifier">handler</span>)
|
494
|
+
61: <span class="ruby-ivar">@handler</span> = <span class="ruby-keyword kw">nil</span>
|
495
|
+
62: <span class="ruby-ivar">@callbacks</span> = {}
|
496
|
+
63: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">handler</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:keys</span>)
|
497
|
+
64: <span class="ruby-ivar">@callbacks</span> = <span class="ruby-identifier">handler</span>
|
498
|
+
65: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">handler</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Module</span>)
|
499
|
+
66: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">class_eval</span> {
|
500
|
+
67: <span class="ruby-identifier">include</span> <span class="ruby-identifier">handler</span>
|
501
|
+
68: }
|
502
|
+
69: <span class="ruby-keyword kw">else</span>
|
503
|
+
70: <span class="ruby-ivar">@handler</span> = <span class="ruby-identifier">handler</span>
|
504
|
+
71: <span class="ruby-keyword kw">end</span>
|
505
|
+
72: <span class="ruby-keyword kw">end</span>
|
506
|
+
</pre>
|
507
|
+
</div>
|
508
|
+
</div>
|
509
|
+
</div>
|
510
|
+
|
511
|
+
<div id="method-M000013" class="method-detail">
|
512
|
+
<a name="M000013"></a>
|
513
|
+
|
514
|
+
<div class="method-heading">
|
515
|
+
<a href="#M000013" class="method-signature">
|
516
|
+
<span class="method-name">start_closing</span><span class="method-args">()</span>
|
517
|
+
</a>
|
518
|
+
</div>
|
519
|
+
|
520
|
+
<div class="method-description">
|
521
|
+
<p>
|
522
|
+
Begin shutting the connection down.
|
523
|
+
</p>
|
524
|
+
<p><a class="source-toggle" href="#"
|
525
|
+
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
526
|
+
<div class="method-source-code" id="M000013-source">
|
527
|
+
<pre>
|
528
|
+
<span class="ruby-comment cmt"># File lib/evented_memcache_client/connectable.rb, line 292</span>
|
529
|
+
292: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start_closing</span>
|
530
|
+
293: <span class="ruby-identifier">close_connection_after_writing</span>
|
531
|
+
294: <span class="ruby-keyword kw">end</span>
|
532
|
+
</pre>
|
533
|
+
</div>
|
534
|
+
</div>
|
535
|
+
</div>
|
536
|
+
|
537
|
+
<div id="method-M000012" class="method-detail">
|
538
|
+
<a name="M000012"></a>
|
539
|
+
|
540
|
+
<div class="method-heading">
|
541
|
+
<a href="#M000012" class="method-signature">
|
542
|
+
<span class="method-name">to_s</span><span class="method-args">()</span>
|
543
|
+
</a>
|
544
|
+
</div>
|
545
|
+
|
546
|
+
<div class="method-description">
|
547
|
+
<p>
|
548
|
+
Turns this sucker into a human-readable string with some semi-useful
|
549
|
+
information.
|
550
|
+
</p>
|
551
|
+
<p><a class="source-toggle" href="#"
|
552
|
+
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
553
|
+
<div class="method-source-code" id="M000012-source">
|
554
|
+
<pre>
|
555
|
+
<span class="ruby-comment cmt"># File lib/evented_memcache_client/connectable.rb, line 276</span>
|
556
|
+
276: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
|
557
|
+
277: <span class="ruby-identifier">str</span> = <span class="ruby-value str">''</span>
|
558
|
+
278: <span class="ruby-identifier">str</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"EM signature: #{signature} peer: #{remote_endpoint}\n"</span>
|
559
|
+
279: <span class="ruby-identifier">str</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"opened: #{@opened_at} (#{Time.now - @opened_at}s)\n"</span>
|
560
|
+
280: <span class="ruby-identifier">str</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"rcvs: #{@rcvs} in: #{@msgs_in} out: #{@msgs_out}\n"</span>
|
561
|
+
281: <span class="ruby-ivar">@rcv_stats</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">msg_name</span>,<span class="ruby-identifier">count</span><span class="ruby-operator">|</span>
|
562
|
+
282: <span class="ruby-identifier">str</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"#{msg_name} in: #{count}\n"</span>
|
563
|
+
283: }
|
564
|
+
284: <span class="ruby-ivar">@snd_stats</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">msg_name</span>,<span class="ruby-identifier">count</span><span class="ruby-operator">|</span>
|
565
|
+
285: <span class="ruby-identifier">str</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"#{msg_name} out: #{count}\n"</span>
|
566
|
+
286: }
|
567
|
+
287: <span class="ruby-identifier">str</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"I+O/sec: #{'%6.4f' % io_per_sec}."</span>
|
568
|
+
288: <span class="ruby-identifier">str</span>
|
569
|
+
289: <span class="ruby-keyword kw">end</span>
|
570
|
+
</pre>
|
571
|
+
</div>
|
572
|
+
</div>
|
573
|
+
</div>
|
574
|
+
|
575
|
+
<div id="method-M000008" class="method-detail">
|
576
|
+
<a name="M000008"></a>
|
577
|
+
|
578
|
+
<div class="method-heading">
|
579
|
+
<a href="#M000008" class="method-signature">
|
580
|
+
<span class="method-name">unbind</span><span class="method-args">()</span>
|
581
|
+
</a>
|
582
|
+
</div>
|
583
|
+
|
584
|
+
<div class="method-description">
|
585
|
+
<p>
|
586
|
+
Called from EM::Connection when the connection is dead.
|
587
|
+
</p>
|
588
|
+
<p><a class="source-toggle" href="#"
|
589
|
+
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
590
|
+
<div class="method-source-code" id="M000008-source">
|
591
|
+
<pre>
|
592
|
+
<span class="ruby-comment cmt"># File lib/evented_memcache_client/connectable.rb, line 104</span>
|
593
|
+
104: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unbind</span>
|
594
|
+
105: <span class="ruby-ivar">@closed_at</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
595
|
+
106: <span class="ruby-ivar">@data</span> = <span class="ruby-keyword kw">nil</span>
|
596
|
+
107: <span class="ruby-identifier">handle</span>(<span class="ruby-identifier">:close</span>, <span class="ruby-keyword kw">self</span>)
|
597
|
+
108: <span class="ruby-keyword kw">end</span>
|
598
|
+
</pre>
|
599
|
+
</div>
|
600
|
+
</div>
|
601
|
+
</div>
|
602
|
+
|
603
|
+
|
604
|
+
</div>
|
605
|
+
|
606
|
+
|
607
|
+
</div>
|
608
|
+
|
609
|
+
|
610
|
+
<div id="validator-badges">
|
611
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
612
|
+
</div>
|
613
|
+
|
614
|
+
</body>
|
615
|
+
</html>
|