boogaloo 0.1

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.
Files changed (57) hide show
  1. data/CHANGELOG +2 -0
  2. data/DEBUGGING +4 -0
  3. data/MIT-LICENSE +7 -0
  4. data/README +106 -0
  5. data/RUNNING_UNIT_TESTS +5 -0
  6. data/Rakefile +44 -0
  7. data/bin/boogaloo +159 -0
  8. data/doc/classes/Boogaloo.html +149 -0
  9. data/doc/classes/Boogaloo/Cache.html +121 -0
  10. data/doc/classes/Boogaloo/Cache/Base.html +664 -0
  11. data/doc/classes/Boogaloo/Cache/Persistent.html +122 -0
  12. data/doc/classes/Boogaloo/Cache/Temporary.html +439 -0
  13. data/doc/classes/Boogaloo/Client.html +111 -0
  14. data/doc/classes/Boogaloo/Client/Connection.html +228 -0
  15. data/doc/classes/Boogaloo/Config.html +540 -0
  16. data/doc/classes/Boogaloo/ServiceGateway.html +176 -0
  17. data/doc/classes/Boogaloo/ServiceRequest.html +210 -0
  18. data/doc/classes/Boogaloo/ThreadPool.html +205 -0
  19. data/doc/classes/Boogaloo/WorkerThread.html +239 -0
  20. data/doc/created.rid +1 -0
  21. data/doc/files/DEBUGGING.html +113 -0
  22. data/doc/files/MIT-LICENSE.html +129 -0
  23. data/doc/files/README.html +261 -0
  24. data/doc/files/examples/boogaloo_conf.html +130 -0
  25. data/doc/files/lib/boogaloo/cache/base_rb.html +101 -0
  26. data/doc/files/lib/boogaloo/cache/persistent_rb.html +108 -0
  27. data/doc/files/lib/boogaloo/cache/temporary_rb.html +101 -0
  28. data/doc/files/lib/boogaloo/client/connection_rb.html +101 -0
  29. data/doc/files/lib/boogaloo/config_rb.html +109 -0
  30. data/doc/files/lib/boogaloo/service_gateway_rb.html +110 -0
  31. data/doc/files/lib/boogaloo/service_request_rb.html +108 -0
  32. data/doc/files/lib/boogaloo/thread_pool_rb.html +101 -0
  33. data/doc/files/lib/boogaloo/util_rb.html +240 -0
  34. data/doc/files/lib/boogaloo/version_rb.html +114 -0
  35. data/doc/files/lib/boogaloo/worker_thread_rb.html +101 -0
  36. data/doc/fr_class_index.html +38 -0
  37. data/doc/fr_file_index.html +41 -0
  38. data/doc/fr_method_index.html +67 -0
  39. data/doc/index.html +24 -0
  40. data/doc/rdoc-style.css +208 -0
  41. data/examples/boogaloo.conf +17 -0
  42. data/lib/boogaloo/cache/base.rb +222 -0
  43. data/lib/boogaloo/cache/persistent.rb +15 -0
  44. data/lib/boogaloo/cache/temporary.rb +173 -0
  45. data/lib/boogaloo/client/connection.rb +55 -0
  46. data/lib/boogaloo/config.rb +206 -0
  47. data/lib/boogaloo/service_gateway.rb +37 -0
  48. data/lib/boogaloo/service_request.rb +39 -0
  49. data/lib/boogaloo/thread_pool.rb +40 -0
  50. data/lib/boogaloo/util.rb +29 -0
  51. data/lib/boogaloo/version.rb +1 -0
  52. data/lib/boogaloo/worker_thread.rb +46 -0
  53. data/test/test_persistent_cache.rb +99 -0
  54. data/test/test_service_gateway.rb +27 -0
  55. data/test/test_synchronicity.rb +29 -0
  56. data/test/test_temporary_cache.rb +42 -0
  57. metadata +113 -0
@@ -0,0 +1,261 @@
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>File: README</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="fileHeader">
50
+ <h1>README</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>README
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Sat Oct 14 00:37:54 BST 2006</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <h1><a href="../classes/Boogaloo.html">Boogaloo</a> Simple Cache Server</h1>
73
+ <p>
74
+ <a href="../classes/Boogaloo.html">Boogaloo</a> is a very simple cache
75
+ server that provides permanent and temporary object persistence, with the
76
+ ability for objects to &quot;expire&quot;. <a
77
+ href="../classes/Boogaloo.html">Boogaloo</a> can also be used for housing
78
+ custom services, such as a registry or specialized cache implementation.
79
+ </p>
80
+ <p>
81
+ <a href="../classes/Boogaloo.html">Boogaloo</a> was initially developed for
82
+ a RubyOnRails application that needed basic persistant object caching
83
+ across multiple web nodes and a mechanism for caching objects related to a
84
+ user temporarily rather than storing them in the session.
85
+ </p>
86
+ <h2>Getting Started</h2>
87
+ <p>
88
+ Caches are created in <a href="../classes/Boogaloo.html">Boogaloo</a> by
89
+ specifying them in the configuration file. For example, to host one
90
+ persistent and one temporary cache, your config may look something like
91
+ this:
92
+ </p>
93
+ <pre>
94
+ Server:
95
+ host: localhost
96
+ port: 7777
97
+ worker_threads: 3
98
+
99
+ PersistentCaches:
100
+
101
+ MyPersistentCache:
102
+ instance_name: main_cache
103
+
104
+ TemporaryCaches:
105
+
106
+ MyTempCache:
107
+ instance_name: temp_cache
108
+ check_frequency: 10
109
+ </pre>
110
+ <ol>
111
+ <li><tt>instance_name</tt> is the method via which the cache instance will be
112
+ accessed by the client.
113
+
114
+ </li>
115
+ <li><tt>check_frequency</tt> is the frequency in seconds at which the cache
116
+ will check for stale objects to delete.
117
+
118
+ </li>
119
+ </ol>
120
+ <p>
121
+ An example configuration file can be found in <a
122
+ href="examples/boogaloo_conf.html">examples/boogalooo.conf</a>.
123
+ </p>
124
+ <p>
125
+ Next start the <a href="../classes/Boogaloo.html">Boogaloo</a> server:
126
+ </p>
127
+ <pre>
128
+ boogaloo -d -f boogaloo.conf
129
+ </pre>
130
+ <p>
131
+ Now on the client we access the caches like this:
132
+ </p>
133
+ <pre>
134
+ boogaloo_cache = Boogaloo::Client::Connection.new('localhost', 7777, true)
135
+ boogaloo_cache.main_cache.set(nil, &quot;some_string&quot;, &quot;Hello, World!&quot;)
136
+ boogaloo_cache.temp_cache.set(nil, &quot;some_string&quot;, &quot;Hello, World!&quot;, 20)
137
+ </pre>
138
+ <p>
139
+ &quot;Hello, World!&quot; will persist for the lifetime of the server in
140
+ <em>main_cache</em>, yet will be deleted in 20 seconds unless touched in
141
+ <em>temp_cache</em>. By &quot;unless touched&quot; we mean that if the
142
+ object is fetched from the cache with get() 10 seconds after being added,
143
+ it&#8217;s expiration time will be reset to 20 seconds from the time it was
144
+ fetched.
145
+ </p>
146
+ <p>
147
+ The boolean value passed into <a
148
+ href="../classes/Boogaloo/Client/Connection.html">Connection</a> tells the
149
+ connection to return nil for all requests if the cache server is offline
150
+ rather than throwing an exception.
151
+ </p>
152
+ <h2>Command Line Options</h2>
153
+ <dl>
154
+ <dt><tt>&#8212;config -c</tt></dt><dd>The configuration file to use.
155
+
156
+ </dd>
157
+ <dt><tt>&#8212;daemon -d</tt></dt><dd>Run as a stand-alone process.
158
+
159
+ </dd>
160
+ </dl>
161
+ <h2>Custom Services</h2>
162
+ <p>
163
+ You can also use <a href="../classes/Boogaloo.html">Boogaloo</a> to house
164
+ your own custom services. These services can perform any task you want them
165
+ to, all <a href="../classes/Boogaloo.html">Boogaloo</a> cares about is that
166
+ you provide it with an interface to use.
167
+ </p>
168
+ <p>
169
+ Let say we create a new service called <em>MyService</em> and put it in a
170
+ folder called /home/me/BoogalooServices/MyService, the only required file
171
+ is an interface.rb
172
+ </p>
173
+ <pre>
174
+ module MyService
175
+
176
+ class Interface
177
+
178
+ def initialize(arg1, arg2)
179
+
180
+ self.arg1 = arg1
181
+ self.arg2 = arg2
182
+
183
+ end
184
+
185
+ def arg1
186
+
187
+ self.arg1
188
+
189
+ end
190
+
191
+ def arg2
192
+
193
+ self.arg2
194
+
195
+ end
196
+
197
+ end
198
+
199
+ end
200
+ </pre>
201
+ <p>
202
+ And then in our configuration file we put something like:
203
+ </p>
204
+ <pre>
205
+ Services:
206
+
207
+ MyService:
208
+ instance_name: my_service
209
+ path: /home/me/BoogalooServices/MyService
210
+ arguments:
211
+ - Hello
212
+ - World
213
+ </pre>
214
+ <p>
215
+ Restart <a href="../classes/Boogaloo.html">Boogaloo</a> and you&#8217;ll
216
+ your service will be available as <em>my_service</em> on the client.
217
+ </p>
218
+ <p>
219
+ <a href="../classes/Boogaloo.html">Boogaloo</a> requires that your
220
+ <em>Interface</em> class is contained within a module with the same name as
221
+ specified in the configuration, in this case its <em>MyService</em>.
222
+ </p>
223
+ <p>
224
+ <a href="../classes/Boogaloo.html">Boogaloo</a> can also manage your
225
+ $LOAD_PATH for you, see the detailed configuration <a
226
+ href="../classes/Boogaloo/Config.html">documentation</a> for more
227
+ information.
228
+ </p>
229
+
230
+ </div>
231
+
232
+
233
+ </div>
234
+
235
+
236
+ </div>
237
+
238
+
239
+ <!-- if includes -->
240
+
241
+ <div id="section">
242
+
243
+
244
+
245
+
246
+
247
+
248
+
249
+
250
+ <!-- if method_list -->
251
+
252
+
253
+ </div>
254
+
255
+
256
+ <div id="validator-badges">
257
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
258
+ </div>
259
+
260
+ </body>
261
+ </html>
@@ -0,0 +1,130 @@
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>File: boogaloo.conf</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="fileHeader">
50
+ <h1>boogaloo.conf</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>examples/boogaloo.conf
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Sat Oct 14 01:20:51 BST 2006</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <p>
73
+ # Example <a href="../../classes/Boogaloo.html">Boogaloo</a> configuration.
74
+ </p>
75
+ <p>
76
+ Server:
77
+ </p>
78
+ <pre>
79
+ host: localhost
80
+ port: 7777
81
+ worker_threads: 3
82
+ </pre>
83
+ <p>
84
+ PersistentCaches:
85
+ </p>
86
+ <pre>
87
+ MainCache:
88
+ instance_name: main_cache
89
+ </pre>
90
+ <p>
91
+ TemporaryCaches:
92
+ </p>
93
+ <pre>
94
+ TempCache:
95
+ instance_name: temp_cache
96
+ check_frequency: 10
97
+ </pre>
98
+
99
+ </div>
100
+
101
+
102
+ </div>
103
+
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
+
121
+
122
+ </div>
123
+
124
+
125
+ <div id="validator-badges">
126
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
127
+ </div>
128
+
129
+ </body>
130
+ </html>
@@ -0,0 +1,101 @@
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>File: base.rb</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="fileHeader">
50
+ <h1>base.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>lib/boogaloo/cache/base.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Sat Oct 14 00:22:24 BST 2006</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+
72
+
73
+ </div>
74
+
75
+
76
+ </div>
77
+
78
+
79
+ <!-- if includes -->
80
+
81
+ <div id="section">
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+ <!-- if method_list -->
91
+
92
+
93
+ </div>
94
+
95
+
96
+ <div id="validator-badges">
97
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
98
+ </div>
99
+
100
+ </body>
101
+ </html>