spymemcached.jruby 1.0.4-java → 1.0.5-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de172a58da9de394e290392fe8e3797e917d98ca
4
- data.tar.gz: c73d9b51e084d5858d7191a4a5ab93f6bd6642bd
3
+ metadata.gz: 1a6edd4c7d3f8e0da507d7fe7f7a2c4a0b2414c3
4
+ data.tar.gz: fbf5f5f14abae86a2a5927c1057387aacfbd293f
5
5
  SHA512:
6
- metadata.gz: e7533c8391fb29bf4cabdfcdfb97319d4b0924f164d87e8e67e1fdda173135fd03bbb24ab863eadb0670928a1dbf345f3f29f8e36b1c3e523c35f7215d4eebbe
7
- data.tar.gz: f035eca85fbb17adc7e5d493a8f0d84880f9e38fa7270893a7beac3bd5e7adffb1798971fae850ae9c756aad446897cc5c68d76980abe8cbc0314ac22f58536a
6
+ metadata.gz: 8e58ff82da3526ba9f34bf83c8cf2c355f4ddb2e7e4dc85617b66850c805b16a4576ae88a8651731eddc572723d5a296b32d9d6bbf955b34ccdfd1786231a28a
7
+ data.tar.gz: 208a5a87e1887c8c35688ca8678a63f37888ef75146909f4c45b951abe4c7767dd5703b522ce366bf72bdae530c8b4454202dbaa7b1dc30c22416f240eecd666
data/lib/spymemcached.rb CHANGED
@@ -140,8 +140,8 @@ class Spymemcached
140
140
  # characters properly.
141
141
  def escape_key(key)
142
142
  key = key.to_s.dup
143
- key = key.force_encoding(Encoding::ASCII_8BIT)
144
- key = key.gsub(ESCAPE_KEY_CHARS){ |match| "%#{match.getbyte(0).to_s(16).upcase}" }
143
+ key = key.force_encoding(Encoding::ASCII_8BIT) if defined?(Encoding)
144
+ key = key.gsub(ESCAPE_KEY_CHARS){ |match| "%#{match.bytes.to_a[0].to_s(16).upcase}" }
145
145
  key = "#{key[0, 213]}:md5:#{Digest::MD5.hexdigest(key)}" if key.size > 250
146
146
  key
147
147
  end
@@ -174,7 +174,15 @@ class SpymemcachedTest < Test::Unit::TestCase
174
174
  assert_match(/\d\.\d+\.\d+/, v.values.first)
175
175
  end
176
176
 
177
- def test_escape_key
177
+ def test_handles_invalid_key_and_utf8_chars
178
+ k = 'k 开'
179
+ @client.add(k, 'v1')
180
+ assert_equal('v1', @client.get(k))
181
+ @client.set(k, 'v2')
182
+ assert_equal({k => 'v2'}, @client.get_multi(k))
183
+ end
184
+
185
+ def test_handles_long_string_key
178
186
  k = 'k 开' * 250
179
187
  @client.add(k, 'v1')
180
188
  assert_equal('v1', @client.get(k))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spymemcached.jruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: java
6
6
  authors:
7
7
  - Xiao Li