jruby-memcached 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -0
- data/lib/memcached/version.rb +1 -1
- data/spec/memcached_spec.rb +12 -0
- data/src/main/java/com/openfeint/memcached/Memcached.java +8 -0
- metadata +2 -2
data/CHANGELOG.md
CHANGED
data/lib/memcached/version.rb
CHANGED
data/spec/memcached_spec.rb
CHANGED
@@ -231,5 +231,17 @@ describe Memcached do
|
|
231
231
|
end
|
232
232
|
end
|
233
233
|
end
|
234
|
+
|
235
|
+
context "active?" do
|
236
|
+
it "should be true if has available servers" do
|
237
|
+
expect(@memcached.active?).to eq(true)
|
238
|
+
end
|
239
|
+
|
240
|
+
it "should be false if hasn't available servers" do
|
241
|
+
@memcached_bad = Memcached.new(["127.0.0.1:22121"])
|
242
|
+
expect(@memcached_bad.active?).to eq(false)
|
243
|
+
@memcached_bad.quit
|
244
|
+
end
|
245
|
+
end
|
234
246
|
end
|
235
247
|
end
|
@@ -32,6 +32,7 @@ import java.util.List;
|
|
32
32
|
import java.util.HashMap;
|
33
33
|
import java.util.Map;
|
34
34
|
import java.util.concurrent.ExecutionException;
|
35
|
+
import java.util.Collection;
|
35
36
|
|
36
37
|
@JRubyClass(name = "Memcached")
|
37
38
|
public class Memcached extends RubyObject {
|
@@ -376,6 +377,13 @@ public class Memcached extends RubyObject {
|
|
376
377
|
return context.nil;
|
377
378
|
}
|
378
379
|
|
380
|
+
@JRubyMethod(name = "active?")
|
381
|
+
public IRubyObject isActive(ThreadContext context) {
|
382
|
+
Ruby ruby = context.getRuntime();
|
383
|
+
Collection addresses = client.getAvailableServers();
|
384
|
+
return ruby.newBoolean(!addresses.isEmpty());
|
385
|
+
}
|
386
|
+
|
379
387
|
protected int getDefaultTTL() {
|
380
388
|
return ttl;
|
381
389
|
}
|
metadata
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
name: jruby-memcached
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.5.
|
5
|
+
version: 0.5.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Richard Huang
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|