quetzall-cloud_cache 1.1.5 → 1.1.6

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 (3) hide show
  1. data/lib/cloud_cache.rb +7 -3
  2. data/test/cache_tests.rb +12 -3
  3. metadata +4 -3
data/lib/cloud_cache.rb CHANGED
@@ -76,9 +76,10 @@ module ActiveSupport
76
76
  res = Net::HTTP.start(uri.host, uri.port) do |http|
77
77
  http.request(req)
78
78
  end
79
+ #puts 'response body=' + res.body
79
80
  case res
80
81
  when Net::HTTPSuccess
81
- #puts 'response body=' + res.body
82
+ #puts 'response body=' + res.body
82
83
  res.body
83
84
  else
84
85
  res.error!
@@ -107,6 +108,7 @@ module ActiveSupport
107
108
 
108
109
 
109
110
  def get_multi(keys, raw=false)
111
+ return {} if keys.size == 0
110
112
  kj = keys.to_json
111
113
  #puts "keys.to_json = " + kj
112
114
  extra_headers = {"keys" => kj }
@@ -128,7 +130,7 @@ module ActiveSupport
128
130
  val = ""
129
131
  count = 0
130
132
  body.each_line do |line|
131
- # print 'LINE=' + line
133
+ #print 'LINE=' + line
132
134
  if line == "END\r\n"
133
135
  # puts 'ENDED!!!'
134
136
  break
@@ -146,7 +148,9 @@ module ActiveSupport
146
148
  end
147
149
  count += 1
148
150
  end
149
- values[curr_key] = raw ? val.strip : Marshal.load(val.strip)
151
+ if !val.nil? && val != ""
152
+ values[curr_key] = raw ? val.strip : Marshal.load(val.strip)
153
+ end
150
154
  #puts 'values=' + values.inspect
151
155
  values
152
156
  end
data/test/cache_tests.rb CHANGED
@@ -147,7 +147,16 @@ class CacheTests < Test::Unit::TestCase
147
147
  end
148
148
 
149
149
  def test_get_multi
150
- @cache.remove("m1") rescue false
150
+
151
+ kz = []
152
+ vz = @cache.get_multi(kz)
153
+ assert vz.size == 0
154
+
155
+ kz = ["nothere"]
156
+ vz = @cache.get_multi(kz)
157
+ assert vz.size == 0
158
+
159
+ @cache.remove("m1") rescue false
151
160
  @cache.remove("m2") rescue false
152
161
  @cache.remove("m3") rescue false
153
162
  @cache.remove("m4") rescue false
@@ -156,7 +165,7 @@ class CacheTests < Test::Unit::TestCase
156
165
  @cache.put("m2", "v2", 500, false)
157
166
  @cache.put("m4", MyClass.new("Travis", 10), 500, false)
158
167
 
159
- kz = Array["m1", "m2", "m3", "m4"]
168
+ kz = ["m1", "m2", "m3", "m4"]
160
169
  vz = @cache.get_multi(kz)
161
170
 
162
171
  assert_equal("v1", vz["m1"]);
@@ -167,7 +176,7 @@ class CacheTests < Test::Unit::TestCase
167
176
 
168
177
  @cache.put("m3", MyClass.new("Leroy", 3), 500, false)
169
178
 
170
- kz = Array["m1", "m2", "m3", "m4"]
179
+ kz = ["m1", "m2", "m3", "m4"]
171
180
  vz = @cache.get_multi(kz)
172
181
 
173
182
  assert_equal("v1", vz["m1"]);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quetzall-cloud_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Reeder
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-22 00:00:00 -07:00
12
+ date: 2009-08-13 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -28,6 +28,7 @@ files:
28
28
  - README.txt
29
29
  has_rdoc: true
30
30
  homepage: http://github.com/quetzall/cloud_cache/
31
+ licenses:
31
32
  post_install_message:
32
33
  rdoc_options:
33
34
  - --charset=UTF-8
@@ -48,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
48
49
  requirements: []
49
50
 
50
51
  rubyforge_project:
51
- rubygems_version: 1.2.0
52
+ rubygems_version: 1.3.5
52
53
  signing_key:
53
54
  specification_version: 2
54
55
  summary: Client library for Quetzall's CloudCache service.