boogaloo 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/DEBUGGING +4 -0
- data/MIT-LICENSE +7 -0
- data/README +106 -0
- data/RUNNING_UNIT_TESTS +5 -0
- data/Rakefile +44 -0
- data/bin/boogaloo +159 -0
- data/doc/classes/Boogaloo.html +149 -0
- data/doc/classes/Boogaloo/Cache.html +121 -0
- data/doc/classes/Boogaloo/Cache/Base.html +664 -0
- data/doc/classes/Boogaloo/Cache/Persistent.html +122 -0
- data/doc/classes/Boogaloo/Cache/Temporary.html +439 -0
- data/doc/classes/Boogaloo/Client.html +111 -0
- data/doc/classes/Boogaloo/Client/Connection.html +228 -0
- data/doc/classes/Boogaloo/Config.html +540 -0
- data/doc/classes/Boogaloo/ServiceGateway.html +176 -0
- data/doc/classes/Boogaloo/ServiceRequest.html +210 -0
- data/doc/classes/Boogaloo/ThreadPool.html +205 -0
- data/doc/classes/Boogaloo/WorkerThread.html +239 -0
- data/doc/created.rid +1 -0
- data/doc/files/DEBUGGING.html +113 -0
- data/doc/files/MIT-LICENSE.html +129 -0
- data/doc/files/README.html +261 -0
- data/doc/files/examples/boogaloo_conf.html +130 -0
- data/doc/files/lib/boogaloo/cache/base_rb.html +101 -0
- data/doc/files/lib/boogaloo/cache/persistent_rb.html +108 -0
- data/doc/files/lib/boogaloo/cache/temporary_rb.html +101 -0
- data/doc/files/lib/boogaloo/client/connection_rb.html +101 -0
- data/doc/files/lib/boogaloo/config_rb.html +109 -0
- data/doc/files/lib/boogaloo/service_gateway_rb.html +110 -0
- data/doc/files/lib/boogaloo/service_request_rb.html +108 -0
- data/doc/files/lib/boogaloo/thread_pool_rb.html +101 -0
- data/doc/files/lib/boogaloo/util_rb.html +240 -0
- data/doc/files/lib/boogaloo/version_rb.html +114 -0
- data/doc/files/lib/boogaloo/worker_thread_rb.html +101 -0
- data/doc/fr_class_index.html +38 -0
- data/doc/fr_file_index.html +41 -0
- data/doc/fr_method_index.html +67 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/examples/boogaloo.conf +17 -0
- data/lib/boogaloo/cache/base.rb +222 -0
- data/lib/boogaloo/cache/persistent.rb +15 -0
- data/lib/boogaloo/cache/temporary.rb +173 -0
- data/lib/boogaloo/client/connection.rb +55 -0
- data/lib/boogaloo/config.rb +206 -0
- data/lib/boogaloo/service_gateway.rb +37 -0
- data/lib/boogaloo/service_request.rb +39 -0
- data/lib/boogaloo/thread_pool.rb +40 -0
- data/lib/boogaloo/util.rb +29 -0
- data/lib/boogaloo/version.rb +1 -0
- data/lib/boogaloo/worker_thread.rb +46 -0
- data/test/test_persistent_cache.rb +99 -0
- data/test/test_service_gateway.rb +27 -0
- data/test/test_synchronicity.rb +29 -0
- data/test/test_temporary_cache.rb +42 -0
- metadata +113 -0
@@ -0,0 +1,122 @@
|
|
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: Boogaloo::Cache::Persistent</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">Boogaloo::Cache::Persistent</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/boogaloo/cache/persistent_rb.html">
|
59
|
+
lib/boogaloo/cache/persistent.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="Base.html">
|
69
|
+
Boogaloo::Cache::Base
|
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 persistent cache in which objects persist for the lifetime of the server.
|
86
|
+
</p>
|
87
|
+
<p>
|
88
|
+
See <a href="Base.html">Boogaloo::Cache::Base</a> for common cache methods.
|
89
|
+
</p>
|
90
|
+
|
91
|
+
</div>
|
92
|
+
|
93
|
+
|
94
|
+
</div>
|
95
|
+
|
96
|
+
|
97
|
+
</div>
|
98
|
+
|
99
|
+
|
100
|
+
<!-- if includes -->
|
101
|
+
|
102
|
+
<div id="section">
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
<!-- if method_list -->
|
112
|
+
|
113
|
+
|
114
|
+
</div>
|
115
|
+
|
116
|
+
|
117
|
+
<div id="validator-badges">
|
118
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
119
|
+
</div>
|
120
|
+
|
121
|
+
</body>
|
122
|
+
</html>
|
@@ -0,0 +1,439 @@
|
|
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: Boogaloo::Cache::Temporary</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">Boogaloo::Cache::Temporary</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/boogaloo/cache/temporary_rb.html">
|
59
|
+
lib/boogaloo/cache/temporary.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="Base.html">
|
69
|
+
Boogaloo::Cache::Base
|
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 temporary cache in which objects can expire and are subsequently deleted
|
86
|
+
when they do. The frequency at which the cache is checked for objects to
|
87
|
+
delete is determined by the <tt>check_frequency</tt> parameter.
|
88
|
+
</p>
|
89
|
+
<p>
|
90
|
+
See <a href="Base.html">Boogaloo::Cache::Base</a> for common cache methods.
|
91
|
+
</p>
|
92
|
+
|
93
|
+
</div>
|
94
|
+
|
95
|
+
|
96
|
+
</div>
|
97
|
+
|
98
|
+
<div id="method-list">
|
99
|
+
<h3 class="section-bar">Methods</h3>
|
100
|
+
|
101
|
+
<div class="name-list">
|
102
|
+
<a href="#M000021">add</a>
|
103
|
+
<a href="#M000023">get</a>
|
104
|
+
<a href="#M000020">new</a>
|
105
|
+
<a href="#M000024">pull</a>
|
106
|
+
<a href="#M000025">reset</a>
|
107
|
+
<a href="#M000022">set</a>
|
108
|
+
</div>
|
109
|
+
</div>
|
110
|
+
|
111
|
+
</div>
|
112
|
+
|
113
|
+
|
114
|
+
<!-- if includes -->
|
115
|
+
|
116
|
+
<div id="section">
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
<!-- if method_list -->
|
126
|
+
<div id="methods">
|
127
|
+
<h3 class="section-bar">Public Class methods</h3>
|
128
|
+
|
129
|
+
<div id="method-M000020" class="method-detail">
|
130
|
+
<a name="M000020"></a>
|
131
|
+
|
132
|
+
<div class="method-heading">
|
133
|
+
<a href="#M000020" class="method-signature">
|
134
|
+
<span class="method-name">new</span><span class="method-args">(name, config)</span>
|
135
|
+
</a>
|
136
|
+
</div>
|
137
|
+
|
138
|
+
<div class="method-description">
|
139
|
+
<p>
|
140
|
+
Initialize a new temporary cache instance.
|
141
|
+
</p>
|
142
|
+
<p>
|
143
|
+
Parameters:
|
144
|
+
</p>
|
145
|
+
<table>
|
146
|
+
<tr><td valign="top"><tt>name</tt>:</td><td>The name of the cache
|
147
|
+
|
148
|
+
</td></tr>
|
149
|
+
<tr><td valign="top"><tt>config</tt>:</td><td>A Hash containing configuration for the cache.
|
150
|
+
|
151
|
+
</td></tr>
|
152
|
+
</table>
|
153
|
+
<p>
|
154
|
+
Configuration options:
|
155
|
+
</p>
|
156
|
+
<table>
|
157
|
+
<tr><td valign="top"><tt>check_frequency</tt>:</td><td>The frequency in seconds at which the cache will check for objects to
|
158
|
+
delete.
|
159
|
+
|
160
|
+
</td></tr>
|
161
|
+
</table>
|
162
|
+
<p><a class="source-toggle" href="#"
|
163
|
+
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
164
|
+
<div class="method-source-code" id="M000020-source">
|
165
|
+
<pre>
|
166
|
+
<span class="ruby-comment cmt"># File lib/boogaloo/cache/temporary.rb, line 18</span>
|
167
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">config</span>)
|
168
|
+
|
169
|
+
<span class="ruby-keyword kw">super</span>
|
170
|
+
|
171
|
+
<span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> {
|
172
|
+
|
173
|
+
<span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
|
174
|
+
|
175
|
+
<span class="ruby-identifier">sleep</span> <span class="ruby-ivar">@config</span>[<span class="ruby-value str">'check_frequency'</span>].<span class="ruby-identifier">to_f</span>
|
176
|
+
|
177
|
+
<span class="ruby-ivar">@global_store</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
|
178
|
+
|
179
|
+
<span class="ruby-identifier">times_key</span> = <span class="ruby-node">"#{key}_#{@global_store[key].object_id}"</span>
|
180
|
+
|
181
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@times</span>[<span class="ruby-identifier">times_key</span>][<span class="ruby-identifier">:time</span>] <span class="ruby-operator"><=</span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
182
|
+
|
183
|
+
<span class="ruby-ivar">@global_store</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>)
|
184
|
+
<span class="ruby-ivar">@times</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>)
|
185
|
+
|
186
|
+
<span class="ruby-keyword kw">end</span>
|
187
|
+
|
188
|
+
<span class="ruby-keyword kw">end</span>
|
189
|
+
|
190
|
+
<span class="ruby-ivar">@namespace_store</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">nskey</span><span class="ruby-operator">|</span>
|
191
|
+
|
192
|
+
<span class="ruby-ivar">@namespace_store</span>[<span class="ruby-identifier">nskey</span>].<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
|
193
|
+
|
194
|
+
<span class="ruby-identifier">times_key</span> = <span class="ruby-node">"#{nskey}_#{key}_#{@namespace_store[nskey][key].object_id}"</span>
|
195
|
+
|
196
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@times</span>[<span class="ruby-identifier">times_key</span>][<span class="ruby-identifier">:time</span>] <span class="ruby-operator"><=</span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
197
|
+
|
198
|
+
<span class="ruby-ivar">@namespace_store</span>[<span class="ruby-identifier">nskey</span>].<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>)
|
199
|
+
<span class="ruby-ivar">@times</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">times_key</span>)
|
200
|
+
|
201
|
+
<span class="ruby-keyword kw">end</span>
|
202
|
+
|
203
|
+
<span class="ruby-keyword kw">end</span>
|
204
|
+
|
205
|
+
<span class="ruby-keyword kw">end</span>
|
206
|
+
|
207
|
+
<span class="ruby-keyword kw">end</span>
|
208
|
+
|
209
|
+
}
|
210
|
+
|
211
|
+
<span class="ruby-keyword kw">end</span>
|
212
|
+
</pre>
|
213
|
+
</div>
|
214
|
+
</div>
|
215
|
+
</div>
|
216
|
+
|
217
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
218
|
+
|
219
|
+
<div id="method-M000021" class="method-detail">
|
220
|
+
<a name="M000021"></a>
|
221
|
+
|
222
|
+
<div class="method-heading">
|
223
|
+
<a href="#M000021" class="method-signature">
|
224
|
+
<span class="method-name">add</span><span class="method-args">(namespace, key, obj, expires)</span>
|
225
|
+
</a>
|
226
|
+
</div>
|
227
|
+
|
228
|
+
<div class="method-description">
|
229
|
+
<p>
|
230
|
+
Add an object to the cache only if it doesn’t already exist.
|
231
|
+
</p>
|
232
|
+
<p>
|
233
|
+
Parameters:
|
234
|
+
</p>
|
235
|
+
<table>
|
236
|
+
<tr><td valign="top"><tt>namespace</tt>:</td><td>The namespace in which the object will exist. Use <tt>nil</tt> if global
|
237
|
+
namespace is desired.
|
238
|
+
|
239
|
+
</td></tr>
|
240
|
+
<tr><td valign="top"><tt>key</tt>:</td><td>A uniqeue identifier for the object relative to the given namespace.
|
241
|
+
|
242
|
+
</td></tr>
|
243
|
+
<tr><td valign="top"><tt>obj</tt>:</td><td>The object to add to the cache.
|
244
|
+
|
245
|
+
</td></tr>
|
246
|
+
<tr><td valign="top"><tt>expires</tt>:</td><td>The time in seconds which the object should exist in the cache without
|
247
|
+
being touched before it is deleted.
|
248
|
+
|
249
|
+
</td></tr>
|
250
|
+
</table>
|
251
|
+
<p><a class="source-toggle" href="#"
|
252
|
+
onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
|
253
|
+
<div class="method-source-code" id="M000021-source">
|
254
|
+
<pre>
|
255
|
+
<span class="ruby-comment cmt"># File lib/boogaloo/cache/temporary.rb, line 71</span>
|
256
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add</span>(<span class="ruby-identifier">namespace</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">obj</span>, <span class="ruby-identifier">expires</span>)
|
257
|
+
|
258
|
+
<span class="ruby-identifier">check_expires</span>(<span class="ruby-identifier">expires</span>)
|
259
|
+
<span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">namespace</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">obj</span>)
|
260
|
+
<span class="ruby-identifier">set_expiration</span>(<span class="ruby-identifier">namespace</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">obj</span>, <span class="ruby-identifier">expires</span>)
|
261
|
+
|
262
|
+
<span class="ruby-keyword kw">end</span>
|
263
|
+
</pre>
|
264
|
+
</div>
|
265
|
+
</div>
|
266
|
+
</div>
|
267
|
+
|
268
|
+
<div id="method-M000023" class="method-detail">
|
269
|
+
<a name="M000023"></a>
|
270
|
+
|
271
|
+
<div class="method-heading">
|
272
|
+
<a href="#M000023" class="method-signature">
|
273
|
+
<span class="method-name">get</span><span class="method-args">(namespace, key)</span>
|
274
|
+
</a>
|
275
|
+
</div>
|
276
|
+
|
277
|
+
<div class="method-description">
|
278
|
+
<p>
|
279
|
+
Get an object from the cache.
|
280
|
+
</p>
|
281
|
+
<p>
|
282
|
+
Parameters:
|
283
|
+
</p>
|
284
|
+
<table>
|
285
|
+
<tr><td valign="top"><tt>namespace</tt>:</td><td>The namespace to get the object from. Use <tt>nil</tt> if global namespace
|
286
|
+
should be used.
|
287
|
+
|
288
|
+
</td></tr>
|
289
|
+
<tr><td valign="top"><tt>key</tt>:</td><td>A uniqeue identifier for the object relative to the given namespace.
|
290
|
+
|
291
|
+
</td></tr>
|
292
|
+
</table>
|
293
|
+
<p><a class="source-toggle" href="#"
|
294
|
+
onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
|
295
|
+
<div class="method-source-code" id="M000023-source">
|
296
|
+
<pre>
|
297
|
+
<span class="ruby-comment cmt"># File lib/boogaloo/cache/temporary.rb, line 99</span>
|
298
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get</span>(<span class="ruby-identifier">namespace</span>, <span class="ruby-identifier">key</span>)
|
299
|
+
|
300
|
+
<span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">super</span>
|
301
|
+
<span class="ruby-identifier">reset_expiration</span>(<span class="ruby-identifier">namespace</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">ret</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">nil?</span>
|
302
|
+
<span class="ruby-identifier">ret</span>
|
303
|
+
|
304
|
+
<span class="ruby-keyword kw">end</span>
|
305
|
+
</pre>
|
306
|
+
</div>
|
307
|
+
</div>
|
308
|
+
</div>
|
309
|
+
|
310
|
+
<div id="method-M000024" class="method-detail">
|
311
|
+
<a name="M000024"></a>
|
312
|
+
|
313
|
+
<div class="method-heading">
|
314
|
+
<a href="#M000024" class="method-signature">
|
315
|
+
<span class="method-name">pull</span><span class="method-args">(namespace, key)</span>
|
316
|
+
</a>
|
317
|
+
</div>
|
318
|
+
|
319
|
+
<div class="method-description">
|
320
|
+
<p>
|
321
|
+
Pull and object from the cache (get and delete).
|
322
|
+
</p>
|
323
|
+
<p>
|
324
|
+
Parameters:
|
325
|
+
</p>
|
326
|
+
<table>
|
327
|
+
<tr><td valign="top"><tt>namespace</tt>:</td><td>The namespace to get the object from. Use <tt>nil</tt> if global namespace
|
328
|
+
should be used.
|
329
|
+
|
330
|
+
</td></tr>
|
331
|
+
<tr><td valign="top"><tt>key</tt>:</td><td>A uniqeue identifier for the object relative to the given namespace.
|
332
|
+
|
333
|
+
</td></tr>
|
334
|
+
</table>
|
335
|
+
<p><a class="source-toggle" href="#"
|
336
|
+
onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
|
337
|
+
<div class="method-source-code" id="M000024-source">
|
338
|
+
<pre>
|
339
|
+
<span class="ruby-comment cmt"># File lib/boogaloo/cache/temporary.rb, line 112</span>
|
340
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pull</span>(<span class="ruby-identifier">namespace</span>, <span class="ruby-identifier">key</span>)
|
341
|
+
|
342
|
+
<span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">super</span>
|
343
|
+
<span class="ruby-ivar">@times</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">format_times_key</span>(<span class="ruby-identifier">namespace</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">ret</span>)) <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">nil?</span>
|
344
|
+
<span class="ruby-identifier">ret</span>
|
345
|
+
|
346
|
+
<span class="ruby-keyword kw">end</span>
|
347
|
+
</pre>
|
348
|
+
</div>
|
349
|
+
</div>
|
350
|
+
</div>
|
351
|
+
|
352
|
+
<div id="method-M000025" class="method-detail">
|
353
|
+
<a name="M000025"></a>
|
354
|
+
|
355
|
+
<div class="method-heading">
|
356
|
+
<a href="#M000025" class="method-signature">
|
357
|
+
<span class="method-name">reset</span><span class="method-args">()</span>
|
358
|
+
</a>
|
359
|
+
</div>
|
360
|
+
|
361
|
+
<div class="method-description">
|
362
|
+
<p><a class="source-toggle" href="#"
|
363
|
+
onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
|
364
|
+
<div class="method-source-code" id="M000025-source">
|
365
|
+
<pre>
|
366
|
+
<span class="ruby-comment cmt"># File lib/boogaloo/cache/temporary.rb, line 126</span>
|
367
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset</span>
|
368
|
+
|
369
|
+
<span class="ruby-ivar">@times</span> = {}
|
370
|
+
<span class="ruby-keyword kw">super</span>
|
371
|
+
|
372
|
+
<span class="ruby-keyword kw">end</span>
|
373
|
+
</pre>
|
374
|
+
</div>
|
375
|
+
</div>
|
376
|
+
</div>
|
377
|
+
|
378
|
+
<div id="method-M000022" class="method-detail">
|
379
|
+
<a name="M000022"></a>
|
380
|
+
|
381
|
+
<div class="method-heading">
|
382
|
+
<a href="#M000022" class="method-signature">
|
383
|
+
<span class="method-name">set</span><span class="method-args">(namespace, key, obj, expires)</span>
|
384
|
+
</a>
|
385
|
+
</div>
|
386
|
+
|
387
|
+
<div class="method-description">
|
388
|
+
<p>
|
389
|
+
Add an object to the cache, overwriting if one already exists.
|
390
|
+
</p>
|
391
|
+
<p>
|
392
|
+
Parameters:
|
393
|
+
</p>
|
394
|
+
<table>
|
395
|
+
<tr><td valign="top"><tt>namespace</tt>:</td><td>The namespace in which the object will exist. Use <tt>nil</tt> if global
|
396
|
+
namespace should be used.
|
397
|
+
|
398
|
+
</td></tr>
|
399
|
+
<tr><td valign="top"><tt>key</tt>:</td><td>A uniqeue identifier for the object relative to the given namespace.
|
400
|
+
|
401
|
+
</td></tr>
|
402
|
+
<tr><td valign="top"><tt>obj</tt>:</td><td>The object to add to the cache.
|
403
|
+
|
404
|
+
</td></tr>
|
405
|
+
<tr><td valign="top"><tt>expires</tt>:</td><td>The time in seconds which the object should exist in the cache without
|
406
|
+
being touched before it is deleted.
|
407
|
+
|
408
|
+
</td></tr>
|
409
|
+
</table>
|
410
|
+
<p><a class="source-toggle" href="#"
|
411
|
+
onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
|
412
|
+
<div class="method-source-code" id="M000022-source">
|
413
|
+
<pre>
|
414
|
+
<span class="ruby-comment cmt"># File lib/boogaloo/cache/temporary.rb, line 86</span>
|
415
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set</span>(<span class="ruby-identifier">namespace</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">obj</span>, <span class="ruby-identifier">expires</span>)
|
416
|
+
|
417
|
+
<span class="ruby-identifier">check_expires</span>(<span class="ruby-identifier">expires</span>)
|
418
|
+
<span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">namespace</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">obj</span>)
|
419
|
+
<span class="ruby-identifier">set_expiration</span>(<span class="ruby-identifier">namespace</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">obj</span>, <span class="ruby-identifier">expires</span>)
|
420
|
+
|
421
|
+
<span class="ruby-keyword kw">end</span>
|
422
|
+
</pre>
|
423
|
+
</div>
|
424
|
+
</div>
|
425
|
+
</div>
|
426
|
+
|
427
|
+
|
428
|
+
</div>
|
429
|
+
|
430
|
+
|
431
|
+
</div>
|
432
|
+
|
433
|
+
|
434
|
+
<div id="validator-badges">
|
435
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
436
|
+
</div>
|
437
|
+
|
438
|
+
</body>
|
439
|
+
</html>
|