jruby-memcached 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +34 -0
- data/Gemfile.lock +1 -1
- data/README.md +7 -2
- data/lib/memcached.rb +8 -1
- data/lib/memcached/version.rb +1 -1
- data/spec/memcached_spec.rb +79 -1
- data/spec/rails_spec.rb +174 -0
- data/src/main/java/com/openfeint/memcached/Memcached.java +214 -193
- data/src/main/java/com/openfeint/memcached/MemcachedService.java +34 -0
- data/src/main/java/com/openfeint/memcached/Rails.java +238 -0
- data/src/main/java/com/openfeint/memcached/error/Error.java +27 -0
- data/src/main/java/com/openfeint/memcached/error/NotFound.java +7 -0
- data/src/main/java/com/openfeint/memcached/error/NotStored.java +7 -0
- data/src/main/java/com/openfeint/memcached/error/NotSupport.java +7 -0
- data/src/main/java/com/openfeint/memcached/{MarshalTranscoder.java → transcoder/MarshalTranscoder.java} +5 -4
- data/src/main/java/com/openfeint/memcached/{MarshalZlibTranscoder.java → transcoder/MarshalZlibTranscoder.java} +10 -9
- data/target/spymemcached-ext-0.0.1.jar +0 -0
- metadata +96 -80
- data/lib/memcached/exceptions.rb +0 -4
- data/src/main/java/com/openfeint/memcached/MemcachedLibrary.java +0 -52
data/lib/memcached/exceptions.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
package com.openfeint.memcached;
|
2
|
-
|
3
|
-
import java.io.ByteArrayInputStream;
|
4
|
-
import java.io.ByteArrayOutputStream;
|
5
|
-
import java.io.IOException;
|
6
|
-
import java.net.InetSocketAddress;
|
7
|
-
import java.net.SocketAddress;
|
8
|
-
import java.util.ArrayList;
|
9
|
-
import java.util.List;
|
10
|
-
import java.util.Map;
|
11
|
-
import java.util.concurrent.ExecutionException;
|
12
|
-
import net.spy.memcached.CachedData;
|
13
|
-
import net.spy.memcached.MemcachedClient;
|
14
|
-
import net.spy.memcached.transcoders.Transcoder;
|
15
|
-
import org.jruby.Ruby;
|
16
|
-
import org.jruby.RubyClass;
|
17
|
-
import org.jruby.RubyException;
|
18
|
-
import org.jruby.RubyHash;
|
19
|
-
import org.jruby.RubyObject;
|
20
|
-
import org.jruby.RubyString;
|
21
|
-
import org.jruby.RubySymbol;
|
22
|
-
import org.jruby.anno.JRubyClass;
|
23
|
-
import org.jruby.anno.JRubyMethod;
|
24
|
-
import org.jruby.exceptions.RaiseException;
|
25
|
-
import org.jruby.runtime.ObjectAllocator;
|
26
|
-
import org.jruby.runtime.ThreadContext;
|
27
|
-
import org.jruby.runtime.builtin.IRubyObject;
|
28
|
-
import org.jruby.runtime.load.Library;
|
29
|
-
import org.jruby.runtime.marshal.MarshalStream;
|
30
|
-
import org.jruby.runtime.marshal.UnmarshalStream;
|
31
|
-
|
32
|
-
public class MemcachedLibrary implements Library {
|
33
|
-
private Ruby ruby;
|
34
|
-
|
35
|
-
public void load(final Ruby ruby, boolean bln) throws IOException {
|
36
|
-
this.ruby = ruby;
|
37
|
-
|
38
|
-
RubyClass memcached = ruby.defineClass("Memcached", ruby.getObject(), new ObjectAllocator() {
|
39
|
-
public IRubyObject allocate(Ruby ruby, RubyClass rc) {
|
40
|
-
return new Memcached(ruby, rc);
|
41
|
-
}
|
42
|
-
});
|
43
|
-
|
44
|
-
memcached.defineAnnotatedMethods(Memcached.class);
|
45
|
-
|
46
|
-
RubyClass runtimeError = ruby.getRuntimeError();
|
47
|
-
RubyClass memcachedError = memcached.defineClassUnder("Error", runtimeError, runtimeError.getAllocator());
|
48
|
-
memcached.defineClassUnder("NotFound", memcachedError, memcachedError.getAllocator());
|
49
|
-
memcached.defineClassUnder("NotStored", memcachedError, memcachedError.getAllocator());
|
50
|
-
memcached.defineClassUnder("NotSupport", memcachedError, memcachedError.getAllocator());
|
51
|
-
}
|
52
|
-
}
|