jruby-memcached 0.3.0 → 0.4.0
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/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
| @@ -0,0 +1,34 @@ | |
| 1 | 
            +
            package com.openfeint.memcached;
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            import org.jruby.Ruby;
         | 
| 4 | 
            +
            import org.jruby.RubyClass;
         | 
| 5 | 
            +
            import org.jruby.runtime.ObjectAllocator;
         | 
| 6 | 
            +
            import org.jruby.runtime.builtin.IRubyObject;
         | 
| 7 | 
            +
            import org.jruby.runtime.load.BasicLibraryService;
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            import java.io.IOException;
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            public class MemcachedService implements BasicLibraryService {
         | 
| 12 | 
            +
                public boolean basicLoad(final Ruby ruby) throws IOException {
         | 
| 13 | 
            +
                    RubyClass memcached = ruby.defineClass("Memcached", ruby.getObject(), new ObjectAllocator() {
         | 
| 14 | 
            +
                        public IRubyObject allocate(Ruby ruby, RubyClass klazz) {
         | 
| 15 | 
            +
                            return new Memcached(ruby, klazz);
         | 
| 16 | 
            +
                        }
         | 
| 17 | 
            +
                    });
         | 
| 18 | 
            +
                    memcached.defineAnnotatedMethods(Memcached.class);
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                    RubyClass rails = memcached.defineClassUnder("Rails", memcached, new ObjectAllocator() {
         | 
| 21 | 
            +
                        public IRubyObject allocate(Ruby ruby, RubyClass klazz) {
         | 
| 22 | 
            +
                            return new Rails(ruby, klazz);
         | 
| 23 | 
            +
                        }
         | 
| 24 | 
            +
                    });
         | 
| 25 | 
            +
                    rails.defineAnnotatedMethods(Rails.class);
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                    RubyClass runtimeError = ruby.getRuntimeError();
         | 
| 28 | 
            +
                    RubyClass memcachedError = memcached.defineClassUnder("Error", runtimeError, runtimeError.getAllocator());
         | 
| 29 | 
            +
                    memcached.defineClassUnder("NotFound", memcachedError, memcachedError.getAllocator());
         | 
| 30 | 
            +
                    memcached.defineClassUnder("NotStored", memcachedError, memcachedError.getAllocator());
         | 
| 31 | 
            +
                    memcached.defineClassUnder("NotSupport", memcachedError, memcachedError.getAllocator());
         | 
| 32 | 
            +
                    return true;
         | 
| 33 | 
            +
                }
         | 
| 34 | 
            +
            }
         | 
| @@ -0,0 +1,238 @@ | |
| 1 | 
            +
            package com.openfeint.memcached;
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            import org.jruby.Ruby;
         | 
| 4 | 
            +
            import org.jruby.RubyArray;
         | 
| 5 | 
            +
            import org.jruby.RubyBoolean;
         | 
| 6 | 
            +
            import org.jruby.RubyClass;
         | 
| 7 | 
            +
            import org.jruby.RubyHash;
         | 
| 8 | 
            +
            import org.jruby.RubyFixnum;
         | 
| 9 | 
            +
            import org.jruby.RubyObject;
         | 
| 10 | 
            +
            import org.jruby.RubyString;
         | 
| 11 | 
            +
            import org.jruby.anno.JRubyClass;
         | 
| 12 | 
            +
            import org.jruby.anno.JRubyMethod;
         | 
| 13 | 
            +
            import org.jruby.exceptions.RaiseException;
         | 
| 14 | 
            +
            import org.jruby.runtime.Block;
         | 
| 15 | 
            +
            import org.jruby.runtime.ThreadContext;
         | 
| 16 | 
            +
            import org.jruby.runtime.builtin.IRubyObject;
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            import java.util.ArrayList;
         | 
| 19 | 
            +
            import java.util.List;
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            @JRubyClass(name = "Memcached::Rails", parent = "Memcached")
         | 
| 22 | 
            +
            public class Rails extends Memcached {
         | 
| 23 | 
            +
                private boolean stringReturnTypes;
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                public Rails(final Ruby ruby, RubyClass rubyClass) {
         | 
| 26 | 
            +
                    super(ruby, rubyClass);
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                    stringReturnTypes = false;
         | 
| 29 | 
            +
                }
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                @JRubyMethod(name = "initialize", rest = true)
         | 
| 32 | 
            +
                public IRubyObject initialize(ThreadContext context, IRubyObject[] args) {
         | 
| 33 | 
            +
                    Ruby ruby = context.getRuntime();
         | 
| 34 | 
            +
                    RubyHash opts;
         | 
| 35 | 
            +
                    if (args[args.length - 1] instanceof RubyHash) {
         | 
| 36 | 
            +
                        opts = (RubyHash) args[args.length - 1];
         | 
| 37 | 
            +
                    } else {
         | 
| 38 | 
            +
                        opts = new RubyHash(ruby);
         | 
| 39 | 
            +
                    }
         | 
| 40 | 
            +
                    List<String> servers = new ArrayList<String>();
         | 
| 41 | 
            +
                    for (IRubyObject arg : args) {
         | 
| 42 | 
            +
                        if (arg instanceof RubyString) {
         | 
| 43 | 
            +
                            servers.add(arg.toString());
         | 
| 44 | 
            +
                        } else if (arg instanceof RubyArray) {
         | 
| 45 | 
            +
                            servers.addAll((List<String>) arg.convertToArray());
         | 
| 46 | 
            +
                        }
         | 
| 47 | 
            +
                    }
         | 
| 48 | 
            +
                    if (servers.isEmpty()) {
         | 
| 49 | 
            +
                        IRubyObject serverNames = (IRubyObject) opts.get(ruby.newSymbol("servers"));
         | 
| 50 | 
            +
                        servers.addAll((List<String>) serverNames.convertToArray());
         | 
| 51 | 
            +
                    }
         | 
| 52 | 
            +
                    if (opts.containsKey(ruby.newSymbol("namespace"))) {
         | 
| 53 | 
            +
                        opts.put(ruby.newSymbol("prefix_key"), opts.get(ruby.newSymbol("namespace")));
         | 
| 54 | 
            +
                    }
         | 
| 55 | 
            +
                    if (opts.containsKey(ruby.newSymbol("namespace_separator"))) {
         | 
| 56 | 
            +
                        opts.put(ruby.newSymbol("prefix_delimiter"), opts.get(ruby.newSymbol("namespace_separator")));
         | 
| 57 | 
            +
                    }
         | 
| 58 | 
            +
                    if (opts.containsKey(ruby.newSymbol("string_return_types"))) {
         | 
| 59 | 
            +
                        stringReturnTypes = true;
         | 
| 60 | 
            +
                    }
         | 
| 61 | 
            +
                    return super.init(context, servers, opts);
         | 
| 62 | 
            +
                }
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                @JRubyMethod(name = "active?")
         | 
| 65 | 
            +
                public IRubyObject active_p(ThreadContext context) {
         | 
| 66 | 
            +
                    Ruby ruby = context.getRuntime();
         | 
| 67 | 
            +
                    if (((RubyArray) super.servers(context)).isEmpty()) {
         | 
| 68 | 
            +
                        return ruby.getFalse();
         | 
| 69 | 
            +
                    }
         | 
| 70 | 
            +
                    return ruby.getTrue();
         | 
| 71 | 
            +
                }
         | 
| 72 | 
            +
             | 
| 73 | 
            +
                @JRubyMethod(name = { "get", "[]" }, required = 1, optional = 1)
         | 
| 74 | 
            +
                public IRubyObject get(ThreadContext context, IRubyObject[] args) {
         | 
| 75 | 
            +
                    Ruby ruby = context.getRuntime();
         | 
| 76 | 
            +
                    IRubyObject key = args[0];
         | 
| 77 | 
            +
                    RubyBoolean notRaw = notRaw(context, args, 1);
         | 
| 78 | 
            +
                    try {
         | 
| 79 | 
            +
                        return super.get(context, new IRubyObject[] { key, notRaw });
         | 
| 80 | 
            +
                    } catch (RaiseException e) {
         | 
| 81 | 
            +
                        if ("NotFound".equals(e.getException().getMetaClass().getBaseName())) {
         | 
| 82 | 
            +
                            return context.nil;
         | 
| 83 | 
            +
                        }
         | 
| 84 | 
            +
                        throw e;
         | 
| 85 | 
            +
                    }
         | 
| 86 | 
            +
                }
         | 
| 87 | 
            +
             | 
| 88 | 
            +
                @JRubyMethod(name = "read", required = 1, optional = 1)
         | 
| 89 | 
            +
                public IRubyObject read(ThreadContext context, IRubyObject[] args) {
         | 
| 90 | 
            +
                    Ruby ruby = context.getRuntime();
         | 
| 91 | 
            +
                    RubyBoolean not_raw = ruby.getTrue();
         | 
| 92 | 
            +
                    IRubyObject key = args[0];
         | 
| 93 | 
            +
                    RubyBoolean notRaw = notRaw(context, args, 1);
         | 
| 94 | 
            +
                    return get(context, new IRubyObject[] { key, notRaw });
         | 
| 95 | 
            +
                }
         | 
| 96 | 
            +
             | 
| 97 | 
            +
                @JRubyMethod(name = "exist?", required = 1, optional = 1)
         | 
| 98 | 
            +
                public IRubyObject exist_p(ThreadContext context, IRubyObject[] args) {
         | 
| 99 | 
            +
                    Ruby ruby = context.getRuntime();
         | 
| 100 | 
            +
                    try {
         | 
| 101 | 
            +
                        super.get(context, args);
         | 
| 102 | 
            +
                        return ruby.getTrue();
         | 
| 103 | 
            +
                    } catch (RaiseException e) {
         | 
| 104 | 
            +
                        return ruby.getFalse();
         | 
| 105 | 
            +
                    }
         | 
| 106 | 
            +
                }
         | 
| 107 | 
            +
             | 
| 108 | 
            +
                @JRubyMethod(name = "get_multi", required = 1, optional = 1)
         | 
| 109 | 
            +
                public IRubyObject getMulti(ThreadContext context, IRubyObject[] args) {
         | 
| 110 | 
            +
                    Ruby ruby = context.getRuntime();
         | 
| 111 | 
            +
                    IRubyObject keys = args[0];
         | 
| 112 | 
            +
                    RubyBoolean notRaw = notRaw(context, args, 1);
         | 
| 113 | 
            +
                    return super.get(context, new IRubyObject[] { keys, notRaw });
         | 
| 114 | 
            +
                }
         | 
| 115 | 
            +
             | 
| 116 | 
            +
                @JRubyMethod(name = { "set", "[]=" }, required = 2, optional = 2)
         | 
| 117 | 
            +
                public IRubyObject set(ThreadContext context, IRubyObject[] args) {
         | 
| 118 | 
            +
                    Ruby ruby = context.getRuntime();
         | 
| 119 | 
            +
                    IRubyObject key = args[0];
         | 
| 120 | 
            +
                    IRubyObject value = args[1];
         | 
| 121 | 
            +
                    RubyFixnum ttl = getTTL(context, args, 2);
         | 
| 122 | 
            +
                    RubyBoolean notRaw = notRaw(context, args, 3);
         | 
| 123 | 
            +
                    try {
         | 
| 124 | 
            +
                        super.set(context, new IRubyObject[] { key, value, ttl, notRaw });
         | 
| 125 | 
            +
                        return ruby.getTrue();
         | 
| 126 | 
            +
                    } catch (RaiseException e) {
         | 
| 127 | 
            +
                        return ruby.getFalse();
         | 
| 128 | 
            +
                    }
         | 
| 129 | 
            +
                }
         | 
| 130 | 
            +
             | 
| 131 | 
            +
                @JRubyMethod(name = "write", required = 2, optional = 1)
         | 
| 132 | 
            +
                public IRubyObject write(ThreadContext context, IRubyObject[] args) {
         | 
| 133 | 
            +
                    Ruby ruby = context.getRuntime();
         | 
| 134 | 
            +
                    IRubyObject key = args[0];
         | 
| 135 | 
            +
                    IRubyObject value = args[1];
         | 
| 136 | 
            +
                    RubyFixnum ttl = getTTL(context, args, 2);
         | 
| 137 | 
            +
                    RubyBoolean notRaw = notRaw(context, args, 2);
         | 
| 138 | 
            +
                    return set(context, new IRubyObject[] { key, value, ttl, notRaw });
         | 
| 139 | 
            +
                }
         | 
| 140 | 
            +
             | 
| 141 | 
            +
                @JRubyMethod(name = "fetch", required = 1, optional = 1)
         | 
| 142 | 
            +
                public IRubyObject fetch(ThreadContext context, IRubyObject[] args, Block block) {
         | 
| 143 | 
            +
                    Ruby ruby = context.getRuntime();
         | 
| 144 | 
            +
                    IRubyObject key = args[0];
         | 
| 145 | 
            +
                    RubyHash options;
         | 
| 146 | 
            +
                    if (args.length > 1) {
         | 
| 147 | 
            +
                        options = (RubyHash) args[1];
         | 
| 148 | 
            +
                    } else {
         | 
| 149 | 
            +
                        options = new RubyHash(ruby);
         | 
| 150 | 
            +
                    }
         | 
| 151 | 
            +
                    IRubyObject value = read(context, args);
         | 
| 152 | 
            +
                    if (value.isNil()) {
         | 
| 153 | 
            +
                        value = block.call(context);
         | 
| 154 | 
            +
                        write(context, new IRubyObject[] { key, value, options });
         | 
| 155 | 
            +
                    }
         | 
| 156 | 
            +
                    return value;
         | 
| 157 | 
            +
                }
         | 
| 158 | 
            +
             | 
| 159 | 
            +
                @JRubyMethod(name = "add", required = 2, optional = 2)
         | 
| 160 | 
            +
                public IRubyObject add(ThreadContext context, IRubyObject[] args) {
         | 
| 161 | 
            +
                    Ruby ruby = context.getRuntime();
         | 
| 162 | 
            +
                    if (args.length > 3) {
         | 
| 163 | 
            +
                        if (ruby.getTrue() == args[3]) {
         | 
| 164 | 
            +
                            args[3] = ruby.getFalse();
         | 
| 165 | 
            +
                        } else {
         | 
| 166 | 
            +
                            args[3] = ruby.getTrue();
         | 
| 167 | 
            +
                        }
         | 
| 168 | 
            +
                    }
         | 
| 169 | 
            +
                    try {
         | 
| 170 | 
            +
                        super.add(context, args);
         | 
| 171 | 
            +
                        if (stringReturnTypes) {
         | 
| 172 | 
            +
                            return ruby.newString("STORED\r\n");
         | 
| 173 | 
            +
                        } else {
         | 
| 174 | 
            +
                            return ruby.getTrue();
         | 
| 175 | 
            +
                        }
         | 
| 176 | 
            +
                    } catch (RaiseException e) {
         | 
| 177 | 
            +
                        if (stringReturnTypes) {
         | 
| 178 | 
            +
                            return ruby.newString("NOT STORED\r\n");
         | 
| 179 | 
            +
                        } else {
         | 
| 180 | 
            +
                            return ruby.getFalse();
         | 
| 181 | 
            +
                        }
         | 
| 182 | 
            +
                    }
         | 
| 183 | 
            +
                }
         | 
| 184 | 
            +
             | 
| 185 | 
            +
                @JRubyMethod(name = "delete", required = 1, optional = 1)
         | 
| 186 | 
            +
                public IRubyObject delete(ThreadContext context, IRubyObject[] args) {
         | 
| 187 | 
            +
                    try {
         | 
| 188 | 
            +
                        super.delete(context, args[0]);
         | 
| 189 | 
            +
                    } catch(RaiseException e) { }
         | 
| 190 | 
            +
             | 
| 191 | 
            +
                    return context.nil;
         | 
| 192 | 
            +
                }
         | 
| 193 | 
            +
             | 
| 194 | 
            +
                @JRubyMethod(name = { "flush", "flush_all", "clear" })
         | 
| 195 | 
            +
                public IRubyObject flush(ThreadContext context) {
         | 
| 196 | 
            +
                    return super.flush(context);
         | 
| 197 | 
            +
                }
         | 
| 198 | 
            +
             | 
| 199 | 
            +
                @JRubyMethod(name = "read_multi", rest = true)
         | 
| 200 | 
            +
                public IRubyObject readMulti(ThreadContext context, IRubyObject[] args) {
         | 
| 201 | 
            +
                    Ruby ruby = context.getRuntime();
         | 
| 202 | 
            +
                    if (args.length == 0) {
         | 
| 203 | 
            +
                        return new RubyHash(ruby);
         | 
| 204 | 
            +
                    } else {
         | 
| 205 | 
            +
                        return getMulti(context, args);
         | 
| 206 | 
            +
                    }
         | 
| 207 | 
            +
                }
         | 
| 208 | 
            +
             | 
| 209 | 
            +
                private RubyFixnum getTTL(ThreadContext context, IRubyObject[] args, int index) {
         | 
| 210 | 
            +
                    Ruby ruby = context.getRuntime();
         | 
| 211 | 
            +
                    if (args.length > index) {
         | 
| 212 | 
            +
                        if (args[index] instanceof RubyFixnum) {
         | 
| 213 | 
            +
                            return (RubyFixnum) args[index];
         | 
| 214 | 
            +
                        } else if (args[index] instanceof RubyHash) {
         | 
| 215 | 
            +
                            RubyHash options = (RubyHash) args[index];
         | 
| 216 | 
            +
                            if (options.containsKey(ruby.newSymbol("ttl"))) {
         | 
| 217 | 
            +
                                return (RubyFixnum) options.get(ruby.newSymbol("ttl"));
         | 
| 218 | 
            +
                            } else if (options.containsKey(ruby.newSymbol("expires_in"))) {
         | 
| 219 | 
            +
                                return (RubyFixnum) options.get(ruby.newSymbol("expires_in"));
         | 
| 220 | 
            +
                            }
         | 
| 221 | 
            +
                        }
         | 
| 222 | 
            +
                    }
         | 
| 223 | 
            +
                    return ruby.newFixnum(super.getDefaultTTL());
         | 
| 224 | 
            +
                }
         | 
| 225 | 
            +
             | 
| 226 | 
            +
                private RubyBoolean notRaw(ThreadContext context, IRubyObject[] args, int index) {
         | 
| 227 | 
            +
                    Ruby ruby = context.getRuntime();
         | 
| 228 | 
            +
                    RubyBoolean notRaw = ruby.getTrue();
         | 
| 229 | 
            +
                    if (args.length > index) {
         | 
| 230 | 
            +
                        if (args[index] instanceof RubyBoolean && ruby.getTrue() == (RubyBoolean) args[index]) {
         | 
| 231 | 
            +
                            notRaw = ruby.getFalse();
         | 
| 232 | 
            +
                        } else if (args[index] instanceof RubyHash && ruby.getTrue() == ((RubyHash) args[index]).get(ruby.newSymbol("raw"))) {
         | 
| 233 | 
            +
                            notRaw = ruby.getFalse();
         | 
| 234 | 
            +
                        }
         | 
| 235 | 
            +
                    }
         | 
| 236 | 
            +
                    return notRaw;
         | 
| 237 | 
            +
                }
         | 
| 238 | 
            +
            }
         | 
| @@ -0,0 +1,27 @@ | |
| 1 | 
            +
            package com.openfeint.memcached.error;
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            import org.jruby.Ruby;
         | 
| 4 | 
            +
            import org.jruby.RubyClass;
         | 
| 5 | 
            +
            import org.jruby.RubyException;
         | 
| 6 | 
            +
            import org.jruby.anno.JRubyClass;
         | 
| 7 | 
            +
            import org.jruby.exceptions.RaiseException;
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            @JRubyClass(name = "Memcached::Error", parent = "RuntimeError")
         | 
| 10 | 
            +
            public class Error {
         | 
| 11 | 
            +
                public static RaiseException newNotFound(Ruby ruby, String message) {
         | 
| 12 | 
            +
                    return newMemcachedError(ruby, "NotFound", message);
         | 
| 13 | 
            +
                }
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                public static RaiseException newNotStored(Ruby ruby, String message) {
         | 
| 16 | 
            +
                    return newMemcachedError(ruby, "NotStored", message);
         | 
| 17 | 
            +
                }
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                public static RaiseException newNotSupport(Ruby ruby, String message) {
         | 
| 20 | 
            +
                    return newMemcachedError(ruby, "NotSupport", message);
         | 
| 21 | 
            +
                }
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                private static RaiseException newMemcachedError(Ruby ruby, String klass, String message) {
         | 
| 24 | 
            +
                    RubyClass errorClass = ruby.getModule("Memcached").getClass(klass);
         | 
| 25 | 
            +
                    return new RaiseException(RubyException.newException(ruby, errorClass, message), true);
         | 
| 26 | 
            +
                }
         | 
| 27 | 
            +
            }
         | 
| @@ -1,8 +1,5 @@ | |
| 1 | 
            -
            package com.openfeint.memcached;
         | 
| 1 | 
            +
            package com.openfeint.memcached.transcoder;
         | 
| 2 2 |  | 
| 3 | 
            -
            import java.io.ByteArrayInputStream;
         | 
| 4 | 
            -
            import java.io.ByteArrayOutputStream;
         | 
| 5 | 
            -
            import java.io.IOException;
         | 
| 6 3 | 
             
            import net.spy.memcached.CachedData;
         | 
| 7 4 | 
             
            import net.spy.memcached.transcoders.Transcoder;
         | 
| 8 5 | 
             
            import org.jruby.Ruby;
         | 
| @@ -10,6 +7,10 @@ import org.jruby.runtime.builtin.IRubyObject; | |
| 10 7 | 
             
            import org.jruby.runtime.marshal.MarshalStream;
         | 
| 11 8 | 
             
            import org.jruby.runtime.marshal.UnmarshalStream;
         | 
| 12 9 |  | 
| 10 | 
            +
            import java.io.ByteArrayInputStream;
         | 
| 11 | 
            +
            import java.io.ByteArrayOutputStream;
         | 
| 12 | 
            +
            import java.io.IOException;
         | 
| 13 | 
            +
             | 
| 13 14 | 
             
            /**
         | 
| 14 15 | 
             
             *
         | 
| 15 16 | 
             
             * MarshalTranscoder does marshaling and unmarshaling.
         | 
| @@ -1,10 +1,8 @@ | |
| 1 | 
            -
            package com.openfeint.memcached;
         | 
| 1 | 
            +
            package com.openfeint.memcached.transcoder;
         | 
| 2 2 |  | 
| 3 | 
            -
            import  | 
| 4 | 
            -
            import  | 
| 5 | 
            -
            import  | 
| 6 | 
            -
            import java.io.ObjectOutputStream;
         | 
| 7 | 
            -
            import java.io.IOException;
         | 
| 3 | 
            +
            import com.jcraft.jzlib.ZOutputStream;
         | 
| 4 | 
            +
            import com.jcraft.jzlib.ZInputStream;
         | 
| 5 | 
            +
            import com.jcraft.jzlib.JZlib;
         | 
| 8 6 | 
             
            import net.spy.memcached.CachedData;
         | 
| 9 7 | 
             
            import net.spy.memcached.transcoders.Transcoder;
         | 
| 10 8 | 
             
            import org.jruby.Ruby;
         | 
| @@ -12,9 +10,12 @@ import org.jruby.runtime.builtin.IRubyObject; | |
| 12 10 | 
             
            import org.jruby.runtime.marshal.MarshalStream;
         | 
| 13 11 | 
             
            import org.jruby.runtime.marshal.UnmarshalStream;
         | 
| 14 12 | 
             
            import org.jruby.util.ByteList;
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            import  | 
| 17 | 
            -
            import  | 
| 13 | 
            +
             | 
| 14 | 
            +
            import java.io.ByteArrayInputStream;
         | 
| 15 | 
            +
            import java.io.ByteArrayOutputStream;
         | 
| 16 | 
            +
            import java.io.ObjectInputStream;
         | 
| 17 | 
            +
            import java.io.ObjectOutputStream;
         | 
| 18 | 
            +
            import java.io.IOException;
         | 
| 18 19 |  | 
| 19 20 | 
             
            /**
         | 
| 20 21 | 
             
             *
         | 
| Binary file | 
    
        metadata
    CHANGED
    
    | @@ -1,97 +1,113 @@ | |
| 1 | 
            -
            --- !ruby/object:Gem::Specification | 
| 1 | 
            +
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: jruby-memcached
         | 
| 3 | 
            -
            version: !ruby/object:Gem::Version | 
| 4 | 
            -
              prerelease: | 
| 5 | 
            -
              version: 0. | 
| 3 | 
            +
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            +
              prerelease:
         | 
| 5 | 
            +
              version: 0.4.0
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 | 
            -
            authors: | 
| 8 | 
            -
             | 
| 9 | 
            -
            autorequire: | 
| 7 | 
            +
            authors:
         | 
| 8 | 
            +
            - Richard Huang
         | 
| 9 | 
            +
            autorequire:
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
               | 
| 16 | 
            -
             | 
| 17 | 
            -
                 | 
| 18 | 
            -
                 | 
| 19 | 
            -
                   | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
             | 
| 24 | 
            -
                 | 
| 25 | 
            -
                 | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
                 | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
                 | 
| 36 | 
            -
                 | 
| 12 | 
            +
            date: 2012-08-16 00:00:00.000000000 Z
         | 
| 13 | 
            +
            dependencies:
         | 
| 14 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 15 | 
            +
              name: rspec
         | 
| 16 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 17 | 
            +
                requirements:
         | 
| 18 | 
            +
                - - ! '>='
         | 
| 19 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 20 | 
            +
                    version: !binary |-
         | 
| 21 | 
            +
                      MA==
         | 
| 22 | 
            +
                none: false
         | 
| 23 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 24 | 
            +
                requirements:
         | 
| 25 | 
            +
                - - ! '>='
         | 
| 26 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 27 | 
            +
                    version: !binary |-
         | 
| 28 | 
            +
                      MA==
         | 
| 29 | 
            +
                none: false
         | 
| 30 | 
            +
              prerelease: false
         | 
| 31 | 
            +
              type: :development
         | 
| 32 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 33 | 
            +
              name: mocha
         | 
| 34 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 35 | 
            +
                requirements:
         | 
| 36 | 
            +
                - - ! '>='
         | 
| 37 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 38 | 
            +
                    version: !binary |-
         | 
| 39 | 
            +
                      MA==
         | 
| 40 | 
            +
                none: false
         | 
| 41 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 42 | 
            +
                requirements:
         | 
| 43 | 
            +
                - - ! '>='
         | 
| 44 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 45 | 
            +
                    version: !binary |-
         | 
| 46 | 
            +
                      MA==
         | 
| 47 | 
            +
                none: false
         | 
| 48 | 
            +
              prerelease: false
         | 
| 49 | 
            +
              type: :development
         | 
| 37 50 | 
             
            description: jruby memcacached client which is compatible with memcached gem
         | 
| 38 | 
            -
            email: | 
| 39 | 
            -
             | 
| 51 | 
            +
            email:
         | 
| 52 | 
            +
            - flyerhzm@gmail.com
         | 
| 40 53 | 
             
            executables: []
         | 
| 41 | 
            -
             | 
| 42 54 | 
             
            extensions: []
         | 
| 43 | 
            -
             | 
| 44 55 | 
             
            extra_rdoc_files: []
         | 
| 45 | 
            -
             | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
| 50 | 
            -
             | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 53 | 
            -
             | 
| 54 | 
            -
             | 
| 55 | 
            -
             | 
| 56 | 
            -
             | 
| 57 | 
            -
             | 
| 58 | 
            -
             | 
| 59 | 
            -
             | 
| 60 | 
            -
             | 
| 61 | 
            -
             | 
| 62 | 
            -
             | 
| 63 | 
            -
             | 
| 64 | 
            -
             | 
| 65 | 
            -
             | 
| 66 | 
            -
             | 
| 67 | 
            -
             | 
| 56 | 
            +
            files:
         | 
| 57 | 
            +
            - .gitignore
         | 
| 58 | 
            +
            - CHANGELOG.md
         | 
| 59 | 
            +
            - Gemfile
         | 
| 60 | 
            +
            - Gemfile.lock
         | 
| 61 | 
            +
            - MIT-LICENSE
         | 
| 62 | 
            +
            - README.md
         | 
| 63 | 
            +
            - Rakefile
         | 
| 64 | 
            +
            - benchmark.rb
         | 
| 65 | 
            +
            - jruby_memcached.gemspec
         | 
| 66 | 
            +
            - lib/memcached.rb
         | 
| 67 | 
            +
            - lib/memcached/version.rb
         | 
| 68 | 
            +
            - pom.xml
         | 
| 69 | 
            +
            - spec/memcached_spec.rb
         | 
| 70 | 
            +
            - spec/rails_spec.rb
         | 
| 71 | 
            +
            - spec/spec_helper.rb
         | 
| 72 | 
            +
            - src/main/java/com/openfeint/memcached/Memcached.java
         | 
| 73 | 
            +
            - src/main/java/com/openfeint/memcached/MemcachedService.java
         | 
| 74 | 
            +
            - src/main/java/com/openfeint/memcached/Rails.java
         | 
| 75 | 
            +
            - src/main/java/com/openfeint/memcached/error/Error.java
         | 
| 76 | 
            +
            - src/main/java/com/openfeint/memcached/error/NotFound.java
         | 
| 77 | 
            +
            - src/main/java/com/openfeint/memcached/error/NotStored.java
         | 
| 78 | 
            +
            - src/main/java/com/openfeint/memcached/error/NotSupport.java
         | 
| 79 | 
            +
            - src/main/java/com/openfeint/memcached/transcoder/MarshalTranscoder.java
         | 
| 80 | 
            +
            - src/main/java/com/openfeint/memcached/transcoder/MarshalZlibTranscoder.java
         | 
| 81 | 
            +
            - src/main/java/net/spy/memcached/KetamaNodeLocator.java
         | 
| 82 | 
            +
            - src/main/java/net/spy/memcached/util/DefaultKetamaNodeLocatorConfiguration.java
         | 
| 83 | 
            +
            - target/spymemcached-ext-0.0.1.jar
         | 
| 68 84 | 
             
            homepage: https://github.com/aurorafeint/jruby-memcached
         | 
| 69 85 | 
             
            licenses: []
         | 
| 70 | 
            -
             | 
| 71 | 
            -
            post_install_message: 
         | 
| 86 | 
            +
            post_install_message:
         | 
| 72 87 | 
             
            rdoc_options: []
         | 
| 73 | 
            -
             | 
| 74 | 
            -
             | 
| 75 | 
            -
             | 
| 76 | 
            -
             | 
| 88 | 
            +
            require_paths:
         | 
| 89 | 
            +
            - lib
         | 
| 90 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 91 | 
            +
              requirements:
         | 
| 92 | 
            +
              - - ! '>='
         | 
| 93 | 
            +
                - !ruby/object:Gem::Version
         | 
| 94 | 
            +
                  version: !binary |-
         | 
| 95 | 
            +
                    MA==
         | 
| 77 96 | 
             
              none: false
         | 
| 78 | 
            -
             | 
| 79 | 
            -
             | 
| 80 | 
            -
             | 
| 81 | 
            -
             | 
| 82 | 
            -
             | 
| 97 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 98 | 
            +
              requirements:
         | 
| 99 | 
            +
              - - ! '>='
         | 
| 100 | 
            +
                - !ruby/object:Gem::Version
         | 
| 101 | 
            +
                  version: !binary |-
         | 
| 102 | 
            +
                    MA==
         | 
| 83 103 | 
             
              none: false
         | 
| 84 | 
            -
              requirements: 
         | 
| 85 | 
            -
                - - ">="
         | 
| 86 | 
            -
                  - !ruby/object:Gem::Version 
         | 
| 87 | 
            -
                    version: "0"
         | 
| 88 104 | 
             
            requirements: []
         | 
| 89 | 
            -
             | 
| 90 | 
            -
            rubyforge_project: 
         | 
| 105 | 
            +
            rubyforge_project:
         | 
| 91 106 | 
             
            rubygems_version: 1.8.24
         | 
| 92 | 
            -
            signing_key: | 
| 107 | 
            +
            signing_key:
         | 
| 93 108 | 
             
            specification_version: 3
         | 
| 94 109 | 
             
            summary: jruby compatible memcached client
         | 
| 95 | 
            -
            test_files: | 
| 96 | 
            -
             | 
| 97 | 
            -
             | 
| 110 | 
            +
            test_files:
         | 
| 111 | 
            +
            - spec/memcached_spec.rb
         | 
| 112 | 
            +
            - spec/rails_spec.rb
         | 
| 113 | 
            +
            - spec/spec_helper.rb
         |