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.
- 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,27 @@
|
|
1
|
+
require 'lib/boogaloo/cache/persistent'
|
2
|
+
require 'lib/boogaloo/service_gateway'
|
3
|
+
require 'lib/boogaloo/util'
|
4
|
+
|
5
|
+
class TestServiceGateway < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def test_service_gateway
|
8
|
+
|
9
|
+
pool = Boogaloo::ThreadPool.new 3
|
10
|
+
gateway = Boogaloo::ServiceGateway.new pool, {'test_cache', Boogaloo::Cache::Persistent.new("TestCache", nil)}
|
11
|
+
|
12
|
+
# Test non-existent service failure
|
13
|
+
assert_raises NoMethodError do
|
14
|
+
|
15
|
+
gateway.foo_cache
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
# Test gateway call passthru
|
20
|
+
gateway.test_cache.add(nil, "key_1", "foo")
|
21
|
+
|
22
|
+
# Test pool shutdown
|
23
|
+
assert_equal pool.shutdown, true
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'lib/boogaloo/service_gateway'
|
2
|
+
|
3
|
+
class TestService
|
4
|
+
|
5
|
+
def slow_request
|
6
|
+
|
7
|
+
sleep 2
|
8
|
+
|
9
|
+
end
|
10
|
+
|
11
|
+
def quick_request
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
class TestSynchronicity < Test::Unit::TestCase
|
17
|
+
|
18
|
+
def test_synchronicity
|
19
|
+
|
20
|
+
pool = Boogaloo::ThreadPool.new 2
|
21
|
+
gateway = Boogaloo::ServiceGateway.new pool, {'test_service', TestService.new}
|
22
|
+
gateway.test_service.slow_request
|
23
|
+
start_time = Time.now
|
24
|
+
gateway.test_service.quick_request
|
25
|
+
assert Time.now - start_time < 2
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'lib/boogaloo/cache/temporary'
|
2
|
+
require 'lib/boogaloo/util'
|
3
|
+
|
4
|
+
class TestTemporaryCache < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def test_temporary_cache
|
7
|
+
|
8
|
+
cache = Boogaloo::Cache::Temporary.new('TestCache', { 'check_frequency' => 0.5 })
|
9
|
+
|
10
|
+
# Test with namespace
|
11
|
+
cache.add("test_namespace", "test_key_1", "Hello, World!", 1)
|
12
|
+
assert_equal cache.get("test_namespace", "test_key_1"), "Hello, World!"
|
13
|
+
sleep 1.5
|
14
|
+
assert_equal cache.get("test_namespace", "test_key_1"), nil
|
15
|
+
|
16
|
+
# Test global namespace
|
17
|
+
cache.add(nil, "test_key_2", "Hello, World!", 0.5)
|
18
|
+
assert_equal "Hello, World!", cache.get(nil, "test_key_2")
|
19
|
+
sleep 1
|
20
|
+
assert_equal nil, cache.get(nil, "test_key_2")
|
21
|
+
|
22
|
+
# Test touch updating
|
23
|
+
cache.add(nil, "test_key_3", "Hello, World!", 3)
|
24
|
+
assert_equal "Hello, World!", cache.get(nil, "test_key_3")
|
25
|
+
sleep 2
|
26
|
+
assert_equal "Hello, World!", cache.get(nil, "test_key_3")
|
27
|
+
sleep 2
|
28
|
+
assert_equal "Hello, World!", cache.get(nil, "test_key_3")
|
29
|
+
|
30
|
+
cache.reset
|
31
|
+
|
32
|
+
# Test cache pull
|
33
|
+
cache.set(nil, "test_key_4", "hello!", 10)
|
34
|
+
assert_equal cache.__times_size, 1
|
35
|
+
assert_equal cache.pull(nil, "test_key_4"), "hello!"
|
36
|
+
assert_equal cache.get(nil, "test_key_4"), nil
|
37
|
+
assert_equal cache.pull(nil, "test_key_4"), nil
|
38
|
+
assert_equal cache.__times_size, 0
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.8.11
|
3
|
+
specification_version: 1
|
4
|
+
name: boogaloo
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: "0.1"
|
7
|
+
date: 2006-10-14 00:00:00 +01:00
|
8
|
+
summary: Boogaloo is a very simple cache server that provides permanent and temporary object persistence, with the ability for objects to "expire". Boogaloo can also be used for housing custom services, such as a registry or specialized cache implementation.
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: port001@gmail.com
|
12
|
+
homepage: http://boogaloo.rubyforge.org
|
13
|
+
rubyforge_project: boogaloo
|
14
|
+
description:
|
15
|
+
autorequire:
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: false
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
authors:
|
29
|
+
- Ian Leitch
|
30
|
+
files:
|
31
|
+
- bin/boogaloo
|
32
|
+
- examples/boogaloo.conf
|
33
|
+
- lib/boogaloo
|
34
|
+
- lib/boogaloo/cache
|
35
|
+
- lib/boogaloo/client
|
36
|
+
- lib/boogaloo/config.rb
|
37
|
+
- lib/boogaloo/service_gateway.rb
|
38
|
+
- lib/boogaloo/service_request.rb
|
39
|
+
- lib/boogaloo/util.rb
|
40
|
+
- lib/boogaloo/worker_thread.rb
|
41
|
+
- lib/boogaloo/version.rb
|
42
|
+
- lib/boogaloo/thread_pool.rb
|
43
|
+
- lib/boogaloo/cache/temporary.rb
|
44
|
+
- lib/boogaloo/cache/persistent.rb
|
45
|
+
- lib/boogaloo/cache/base.rb
|
46
|
+
- lib/boogaloo/client/connection.rb
|
47
|
+
- doc/created.rid
|
48
|
+
- doc/rdoc-style.css
|
49
|
+
- doc/files
|
50
|
+
- doc/classes
|
51
|
+
- doc/fr_file_index.html
|
52
|
+
- doc/fr_class_index.html
|
53
|
+
- doc/fr_method_index.html
|
54
|
+
- doc/index.html
|
55
|
+
- doc/files/README.html
|
56
|
+
- doc/files/MIT-LICENSE.html
|
57
|
+
- doc/files/DEBUGGING.html
|
58
|
+
- doc/files/lib
|
59
|
+
- doc/files/examples
|
60
|
+
- doc/files/lib/boogaloo
|
61
|
+
- doc/files/lib/boogaloo/config_rb.html
|
62
|
+
- doc/files/lib/boogaloo/service_gateway_rb.html
|
63
|
+
- doc/files/lib/boogaloo/service_request_rb.html
|
64
|
+
- doc/files/lib/boogaloo/util_rb.html
|
65
|
+
- doc/files/lib/boogaloo/worker_thread_rb.html
|
66
|
+
- doc/files/lib/boogaloo/version_rb.html
|
67
|
+
- doc/files/lib/boogaloo/thread_pool_rb.html
|
68
|
+
- doc/files/lib/boogaloo/cache
|
69
|
+
- doc/files/lib/boogaloo/client
|
70
|
+
- doc/files/lib/boogaloo/cache/temporary_rb.html
|
71
|
+
- doc/files/lib/boogaloo/cache/persistent_rb.html
|
72
|
+
- doc/files/lib/boogaloo/cache/base_rb.html
|
73
|
+
- doc/files/lib/boogaloo/client/connection_rb.html
|
74
|
+
- doc/files/examples/boogaloo_conf.html
|
75
|
+
- doc/classes/Boogaloo.html
|
76
|
+
- doc/classes/Boogaloo
|
77
|
+
- doc/classes/Boogaloo/Client.html
|
78
|
+
- doc/classes/Boogaloo/Client
|
79
|
+
- doc/classes/Boogaloo/Cache.html
|
80
|
+
- doc/classes/Boogaloo/Cache
|
81
|
+
- doc/classes/Boogaloo/WorkerThread.html
|
82
|
+
- doc/classes/Boogaloo/Config.html
|
83
|
+
- doc/classes/Boogaloo/ServiceRequest.html
|
84
|
+
- doc/classes/Boogaloo/ServiceGateway.html
|
85
|
+
- doc/classes/Boogaloo/ThreadPool.html
|
86
|
+
- doc/classes/Boogaloo/Client/Connection.html
|
87
|
+
- doc/classes/Boogaloo/Cache/Persistent.html
|
88
|
+
- doc/classes/Boogaloo/Cache/Base.html
|
89
|
+
- doc/classes/Boogaloo/Cache/Temporary.html
|
90
|
+
- test/test_persistent_cache.rb
|
91
|
+
- test/test_service_gateway.rb
|
92
|
+
- test/test_synchronicity.rb
|
93
|
+
- test/test_temporary_cache.rb
|
94
|
+
- README
|
95
|
+
- MIT-LICENSE
|
96
|
+
- CHANGELOG
|
97
|
+
- Rakefile
|
98
|
+
- RUNNING_UNIT_TESTS
|
99
|
+
- DEBUGGING
|
100
|
+
test_files: []
|
101
|
+
|
102
|
+
rdoc_options: []
|
103
|
+
|
104
|
+
extra_rdoc_files: []
|
105
|
+
|
106
|
+
executables:
|
107
|
+
- boogaloo
|
108
|
+
extensions: []
|
109
|
+
|
110
|
+
requirements: []
|
111
|
+
|
112
|
+
dependencies: []
|
113
|
+
|