jruby-memcache-client 1.6.0 → 1.6.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/README +11 -5
- data/Rakefile +5 -5
- data/VERSION.yml +3 -3
- data/jruby-memcache-client.gemspec +9 -7
- data/lib/memcache.rb +7 -3
- data/spec/jruby_memcache_spec.rb +14 -0
- metadata +6 -5
data/README
CHANGED
@@ -15,10 +15,16 @@ As of right now this code only provides a very minimal amount of functionality,
|
|
15
15
|
|
16
16
|
Installation
|
17
17
|
------------
|
18
|
-
This is a ruby gem that can be installed.
|
18
|
+
This is a ruby gem that can be installed from gemcutter.org.
|
19
19
|
|
20
|
-
gem
|
21
|
-
|
20
|
+
You will first need to install the gemcutter gem and configure your system to use it:
|
21
|
+
|
22
|
+
jruby -S gem install gemcutter
|
23
|
+
jruby -S gem tumble
|
24
|
+
|
25
|
+
You will then be able to install the JRuby Memcache Client gem:
|
26
|
+
|
27
|
+
jruby -S gem install jruby-memcache-client
|
22
28
|
|
23
29
|
Replacing Rail's MemCache Client
|
24
30
|
--------------------------------
|
@@ -34,11 +40,11 @@ if RUBY_PLATFORM =~ /java/i
|
|
34
40
|
Object.instance_eval { remove_const :MemCache }
|
35
41
|
end
|
36
42
|
# Pull in the exact version we want
|
37
|
-
gem '
|
43
|
+
gem 'jruby-memcache-client', '1.6.1'
|
38
44
|
|
39
45
|
# Ensure that the memcache-client path is at the front of the loadpath
|
40
46
|
$LOAD_PATH.each do |path|
|
41
|
-
if path =~ /
|
47
|
+
if path =~ /jruby-memcache-client/
|
42
48
|
$LOAD_PATH.delete(path)
|
43
49
|
$LOAD_PATH.unshift(path)
|
44
50
|
end
|
data/Rakefile
CHANGED
@@ -3,10 +3,10 @@ begin
|
|
3
3
|
Jeweler::Tasks.new do |gemspec|
|
4
4
|
gemspec.name = "jruby-memcache-client"
|
5
5
|
gemspec.summary = "A drop in replacement for Ruby's memcache-client."
|
6
|
-
gemspec.email = "
|
7
|
-
gemspec.homepage = "http://github.com/
|
6
|
+
gemspec.email = "fred@fredjean.net"
|
7
|
+
gemspec.homepage = "http://github.com/ikai/jruby-memcache-client"
|
8
8
|
gemspec.description = "A drop in replacement for Ruby's memcache-client."
|
9
|
-
gemspec.authors = ["Abhi Yerra", "Ikai Lan", "Frederic Jean", "Lennon Day-Reynolds"]
|
9
|
+
gemspec.authors = ["Abhi Yerra", "Ikai Lan", "Frederic Jean", "Lennon Day-Reynolds", "slyphon"]
|
10
10
|
end
|
11
11
|
rescue LoadError
|
12
12
|
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
@@ -15,9 +15,9 @@ end
|
|
15
15
|
if RUBY_PLATFORM =~ /java/i
|
16
16
|
begin
|
17
17
|
require 'spec/rake/spectask'
|
18
|
-
|
18
|
+
|
19
19
|
task :default => :spec
|
20
|
-
|
20
|
+
|
21
21
|
desc "Run the specs for the jruby-memcache-client gem"
|
22
22
|
Spec::Rake::SpecTask.new
|
23
23
|
rescue LoadError
|
data/VERSION.yml
CHANGED
@@ -1,14 +1,17 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
1
4
|
# -*- encoding: utf-8 -*-
|
2
5
|
|
3
6
|
Gem::Specification.new do |s|
|
4
7
|
s.name = %q{jruby-memcache-client}
|
5
|
-
s.version = "1.6.
|
8
|
+
s.version = "1.6.1"
|
6
9
|
|
7
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
-
s.authors = ["Abhi Yerra", "Ikai Lan", "Frederic Jean", "Lennon Day-Reynolds"]
|
9
|
-
s.date = %q{2009-
|
11
|
+
s.authors = ["Abhi Yerra", "Ikai Lan", "Frederic Jean", "Lennon Day-Reynolds", "slyphon"]
|
12
|
+
s.date = %q{2009-11-22}
|
10
13
|
s.description = %q{A drop in replacement for Ruby's memcache-client.}
|
11
|
-
s.email = %q{
|
14
|
+
s.email = %q{fred@fredjean.net}
|
12
15
|
s.extra_rdoc_files = [
|
13
16
|
"README"
|
14
17
|
]
|
@@ -23,11 +26,10 @@ Gem::Specification.new do |s|
|
|
23
26
|
"lib/memcache.rb",
|
24
27
|
"spec/jruby_memcache_spec.rb"
|
25
28
|
]
|
26
|
-
s.has_rdoc = true
|
27
29
|
s.homepage = %q{http://github.com/ikai/jruby-memcache-client}
|
28
30
|
s.rdoc_options = ["--charset=UTF-8"]
|
29
31
|
s.require_paths = ["lib"]
|
30
|
-
s.rubygems_version = %q{1.3.
|
32
|
+
s.rubygems_version = %q{1.3.5}
|
31
33
|
s.summary = %q{A drop in replacement for Ruby's memcache-client.}
|
32
34
|
s.test_files = [
|
33
35
|
"spec/jruby_memcache_spec.rb"
|
@@ -35,7 +37,7 @@ Gem::Specification.new do |s|
|
|
35
37
|
|
36
38
|
if s.respond_to? :specification_version then
|
37
39
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
38
|
-
s.specification_version =
|
40
|
+
s.specification_version = 3
|
39
41
|
|
40
42
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
41
43
|
else
|
data/lib/memcache.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'java'
|
2
|
+
require 'base64'
|
2
3
|
|
3
4
|
require File.dirname(__FILE__) + '/java/java_memcached-release_2.0.1.jar'
|
4
5
|
|
@@ -160,7 +161,8 @@ class MemCache
|
|
160
161
|
return nil if value.nil?
|
161
162
|
unless raw
|
162
163
|
marshal_bytes = java.lang.String.new(value).getBytes(MARSHALLING_CHARSET)
|
163
|
-
|
164
|
+
decoded = Base64.decode64(String.from_java_bytes(marshal_bytes))
|
165
|
+
value = Marshal.load(decoded)
|
164
166
|
end
|
165
167
|
value
|
166
168
|
end
|
@@ -179,7 +181,8 @@ class MemCache
|
|
179
181
|
next if v.nil?
|
180
182
|
unless raw
|
181
183
|
marshal_bytes = java.lang.String.new(v).getBytes(MARSHALLING_CHARSET)
|
182
|
-
|
184
|
+
decoded = Base64.decode64(String.from_java_bytes(marshal_bytes))
|
185
|
+
v = Marshal.load(decoded)
|
183
186
|
end
|
184
187
|
values[k] = v
|
185
188
|
}
|
@@ -299,7 +302,8 @@ class MemCache
|
|
299
302
|
end
|
300
303
|
|
301
304
|
def marshal_value(value)
|
302
|
-
|
305
|
+
encoded = Base64.encode64(Marshal.dump(value))
|
306
|
+
marshal_bytes = encoded.to_java_bytes
|
303
307
|
java.lang.String.new(marshal_bytes, MARSHALLING_CHARSET)
|
304
308
|
end
|
305
309
|
end
|
data/spec/jruby_memcache_spec.rb
CHANGED
@@ -182,6 +182,20 @@ describe MemCache do
|
|
182
182
|
@client.set('obj', obj)
|
183
183
|
@client.get('obj').should == obj
|
184
184
|
end
|
185
|
+
|
186
|
+
it %[should work with those whose marshalled stream contains invalid UTF8 byte sequences] do
|
187
|
+
# this test fails w/o the Base64 encoding step
|
188
|
+
obj = { :foo => 900 }
|
189
|
+
@client.set('obj', obj)
|
190
|
+
@client.get('obj').should == obj
|
191
|
+
end
|
192
|
+
|
193
|
+
it %[should work with binary blobs] do
|
194
|
+
# this test fails w/o the Base64 encoding step
|
195
|
+
blob = "\377\330\377\340\000\020JFIF\000\001\001\000\000\001\000\001\000\000\377"
|
196
|
+
@client.set('blob', blob)
|
197
|
+
@client.get('blob').should == blob
|
198
|
+
end
|
185
199
|
end
|
186
200
|
|
187
201
|
describe "using set with an expiration" do
|
metadata
CHANGED
@@ -1,23 +1,24 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jruby-memcache-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abhi Yerra
|
8
8
|
- Ikai Lan
|
9
9
|
- Frederic Jean
|
10
10
|
- Lennon Day-Reynolds
|
11
|
+
- slyphon
|
11
12
|
autorequire:
|
12
13
|
bindir: bin
|
13
14
|
cert_chain: []
|
14
15
|
|
15
|
-
date: 2009-
|
16
|
+
date: 2009-11-22 00:00:00 -07:00
|
16
17
|
default_executable:
|
17
18
|
dependencies: []
|
18
19
|
|
19
20
|
description: A drop in replacement for Ruby's memcache-client.
|
20
|
-
email:
|
21
|
+
email: fred@fredjean.net
|
21
22
|
executables: []
|
22
23
|
|
23
24
|
extensions: []
|
@@ -58,9 +59,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
59
|
requirements: []
|
59
60
|
|
60
61
|
rubyforge_project:
|
61
|
-
rubygems_version: 1.3.
|
62
|
+
rubygems_version: 1.3.5
|
62
63
|
signing_key:
|
63
|
-
specification_version:
|
64
|
+
specification_version: 3
|
64
65
|
summary: A drop in replacement for Ruby's memcache-client.
|
65
66
|
test_files:
|
66
67
|
- spec/jruby_memcache_spec.rb
|