iron_cache 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +5 -8
- data/iron_cache.gemspec +1 -1
- data/lib/iron_cache/caches.rb +6 -8
- data/lib/iron_cache/version.rb +1 -1
- data/test/test_iron_cache.rb +17 -7
- metadata +6 -6
data/Gemfile.lock
CHANGED
@@ -1,29 +1,26 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
iron_cache (1.
|
4
|
+
iron_cache (1.1.0)
|
5
5
|
iron_core (>= 0.2.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
ffi (1.0.11)
|
11
10
|
iron_core (0.2.0)
|
12
11
|
rest (>= 2.0.0)
|
13
12
|
memcache-client (1.8.5)
|
14
13
|
mime-types (1.19)
|
14
|
+
minitest (3.2.0)
|
15
15
|
net-http-persistent (2.7)
|
16
16
|
rake (0.9.2.2)
|
17
|
-
rest (2.0.
|
17
|
+
rest (2.0.1)
|
18
18
|
net-http-persistent
|
19
19
|
rest-client (>= 0.3.0)
|
20
20
|
rest-client (1.6.7)
|
21
21
|
mime-types (>= 1.16)
|
22
22
|
test-unit (2.5.1)
|
23
|
-
|
24
|
-
ffi (~> 1.0)
|
25
|
-
mime-types (~> 1.18)
|
26
|
-
uber_config (0.0.3)
|
23
|
+
uber_config (0.0.4)
|
27
24
|
|
28
25
|
PLATFORMS
|
29
26
|
ruby
|
@@ -31,7 +28,7 @@ PLATFORMS
|
|
31
28
|
DEPENDENCIES
|
32
29
|
iron_cache!
|
33
30
|
memcache-client
|
31
|
+
minitest
|
34
32
|
rake
|
35
33
|
test-unit
|
36
|
-
typhoeus
|
37
34
|
uber_config
|
data/iron_cache.gemspec
CHANGED
@@ -19,10 +19,10 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.add_runtime_dependency "iron_core", ">= 0.2.0"
|
20
20
|
|
21
21
|
gem.add_development_dependency "test-unit"
|
22
|
+
gem.add_development_dependency "minitest"
|
22
23
|
gem.add_development_dependency "rake"
|
23
24
|
gem.add_development_dependency "memcache-client"
|
24
25
|
gem.add_development_dependency "uber_config"
|
25
|
-
gem.add_development_dependency "typhoeus"
|
26
26
|
|
27
27
|
|
28
28
|
end
|
data/lib/iron_cache/caches.rb
CHANGED
@@ -76,14 +76,12 @@ module IronCache
|
|
76
76
|
q
|
77
77
|
end
|
78
78
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
# @size
|
86
|
-
#end
|
79
|
+
def size
|
80
|
+
return raw["size"] if raw["size"]
|
81
|
+
return @size if @size
|
82
|
+
q = load_cache()
|
83
|
+
@size = q.size
|
84
|
+
end
|
87
85
|
|
88
86
|
def put(k, v, options={})
|
89
87
|
@client.items.put(k, v, options.merge(:cache_name=>name))
|
data/lib/iron_cache/version.rb
CHANGED
data/test/test_iron_cache.rb
CHANGED
@@ -6,18 +6,18 @@ require_relative 'test_base'
|
|
6
6
|
class IronCacheTests < TestBase
|
7
7
|
def setup
|
8
8
|
super
|
9
|
-
|
10
9
|
end
|
10
|
+
|
11
11
|
def test_performance_put_message
|
12
12
|
@client.cache_name = 'test_basics'
|
13
13
|
assert_performance 0.02 do
|
14
14
|
@client.items.put("key", "value")
|
15
15
|
end
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
def test_performance_put_100_messages
|
19
19
|
@client.cache_name = 'test_basics'
|
20
|
-
assert_performance
|
20
|
+
assert_performance 10 do
|
21
21
|
100.times do
|
22
22
|
res = @client.items.put("key", "value")
|
23
23
|
puts "putting message #{res.inspect}"
|
@@ -53,7 +53,7 @@ class IronCacheTests < TestBase
|
|
53
53
|
|
54
54
|
# new style of referencing cache
|
55
55
|
cache = @client.cache("test_basics")
|
56
|
-
res = cache.put(k,v)
|
56
|
+
res = cache.put(k, v)
|
57
57
|
p res
|
58
58
|
assert res.msg
|
59
59
|
|
@@ -72,7 +72,7 @@ class IronCacheTests < TestBase
|
|
72
72
|
assert res.nil?
|
73
73
|
|
74
74
|
# test delete by item
|
75
|
-
res = cache.put(k,v)
|
75
|
+
res = cache.put(k, v)
|
76
76
|
p res
|
77
77
|
assert res.msg
|
78
78
|
|
@@ -87,7 +87,6 @@ class IronCacheTests < TestBase
|
|
87
87
|
assert res.nil?
|
88
88
|
|
89
89
|
|
90
|
-
|
91
90
|
end
|
92
91
|
|
93
92
|
def test_caches
|
@@ -116,7 +115,7 @@ class IronCacheTests < TestBase
|
|
116
115
|
clear_queue
|
117
116
|
k = "key1"
|
118
117
|
v = "hello world!"
|
119
|
-
res = @client.items.put(k, v, :expires_in=>10)
|
118
|
+
res = @client.items.put(k, v, :expires_in => 10)
|
120
119
|
|
121
120
|
res = @client.items.get(k)
|
122
121
|
p res
|
@@ -170,9 +169,20 @@ class IronCacheTests < TestBase
|
|
170
169
|
assert res.value == 5
|
171
170
|
|
172
171
|
res.delete
|
172
|
+
end
|
173
173
|
|
174
|
+
def test_size
|
175
|
+
cache = @client.cache("test_size")
|
176
|
+
num_items = 100
|
174
177
|
|
178
|
+
num_items.times do |i|
|
179
|
+
res = cache.put("key-#{i}", "value")
|
180
|
+
end
|
181
|
+
|
182
|
+
puts "cache.size: #{cache.size}"
|
183
|
+
assert cache.size == num_items
|
175
184
|
end
|
176
185
|
|
186
|
+
|
177
187
|
end
|
178
188
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iron_cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: iron_core
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
47
|
+
name: minitest
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
none: false
|
50
50
|
requirements:
|
@@ -60,7 +60,7 @@ dependencies:
|
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
63
|
+
name: rake
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
|
-
name:
|
79
|
+
name: memcache-client
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
81
81
|
none: false
|
82
82
|
requirements:
|
@@ -92,7 +92,7 @@ dependencies:
|
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: '0'
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
|
-
name:
|
95
|
+
name: uber_config
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
97
97
|
none: false
|
98
98
|
requirements:
|