spymemcached.jruby 1.0.9-java → 1.0.10-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +41 -11
- data/lib/spymemcached/rails23.rb +3 -0
- data/test/spymemcached_rails23_test.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8eb6188bd806396129dbd6186e427323e48454e2
|
4
|
+
data.tar.gz: f30b1e50f0d2630ef62eac42553f6f09d5e6a6be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 462954604f84eca014be63ab9048356d8571e26fca26feb204c984ae0dbc8ba8aec38d66fd5c44db8288cdaa8a466dff3640b6aa81b9c72f27f900e6764db111
|
7
|
+
data.tar.gz: eef22bc388f1ed4450b4b8928b554c7efeb4bd41aa597e2180d2145d0665314692ce02b7f73ebb31fb7f1fef85ea64ed43b2bd73d1b57386da6eb97d850c20cf
|
data/README.md
CHANGED
@@ -1,11 +1,9 @@
|
|
1
|
-
Spymemcached.jruby
|
2
|
-
================
|
1
|
+
# Spymemcached.jruby
|
3
2
|
|
4
3
|
A JRuby extension wraps the latest spymemcached client.
|
4
|
+
Fastest jruby memcached client, threadsafe.
|
5
5
|
|
6
|
-
Usage
|
7
|
-
----------------
|
8
|
-
|
6
|
+
## Usage
|
9
7
|
|
10
8
|
Start a local networked memcached server:
|
11
9
|
|
@@ -28,16 +26,48 @@ Valid +options+ are:
|
|
28
26
|
[:timeout] Time to use as the socket read timeout, seconds. Defaults to 0.5 sec.
|
29
27
|
[:binary] Talks binary protocol with Memcached server. Default to true.
|
30
28
|
|
31
|
-
Rails
|
29
|
+
### Rails 4
|
30
|
+
|
31
|
+
Use [spymemcached_store](https://github.com/ThoughtWorksStudios/spymemcached_store) gem to integrate ActiveSupport cache store and spymemcached.jruby gem.
|
32
|
+
|
33
|
+
### Rails 3
|
34
|
+
|
35
|
+
require 'spymemcached'
|
36
|
+
config.cache_store = :mem_cache_store, Spymemcached.new(servers, options).rails23
|
37
|
+
|
38
|
+
### Rails 2.x
|
39
|
+
|
40
|
+
require 'spymemcached'
|
41
|
+
ActionController::Base.cache_store = :mem_cache_store, Spymemcached.new(servers, options).rails23
|
42
|
+
|
43
|
+
## Compatibility
|
44
|
+
|
45
|
+
The most important different between spymemcached.jruby and other non spymemcached backended memcache client is the support of option :raw.
|
46
|
+
|
47
|
+
As Spymemcached provides mechanism to encode and decode cache data, spymemcached.jruby does marshal dump & load for Ruby object in Java except Ruby string and integer.
|
48
|
+
|
49
|
+
Any Ruby String or Integer type cache data will be directly converted to Java String or Integer.
|
32
50
|
|
33
|
-
|
51
|
+
Hence we don't consider :raw option in spymemcached.jruby.
|
34
52
|
|
35
|
-
Rails
|
53
|
+
However, Rails cache store supports :raw option too when doing read and write on local cache.
|
54
|
+
This behaviour is kept as I'm not sure what to do with it. I'm happy to fix it if you found anything wrong with it.
|
36
55
|
|
37
|
-
|
56
|
+
## Default behaviors
|
38
57
|
|
58
|
+
Spymemcached.jruby applies:
|
39
59
|
|
40
|
-
|
41
|
-
|
60
|
+
* Ketama key hash algorithm (see Spymemcached document or [RJ's blog post](http://www.last.fm/user/RJ/journal/2007/04/10/392555/) for details)
|
61
|
+
* Gzip compressed when the cache data size is larger than 16kb.
|
62
|
+
* Binary protocol
|
63
|
+
|
64
|
+
Other default settings see Spymemcached DefaultConnectionFactory for details.
|
65
|
+
|
66
|
+
## Performance
|
42
67
|
|
43
68
|
[Benchmark result](https://github.com/ThoughtWorksStudios/memcached-client-benchmark) compared with gem dalli and jruby-memcached
|
69
|
+
|
70
|
+
## Further resources
|
71
|
+
|
72
|
+
* [Spymemcached](https://code.google.com/p/spymemcached/)
|
73
|
+
* [Spymemcached Optimizations](https://code.google.com/p/spymemcached/wiki/Optimizations)
|
data/lib/spymemcached/rails23.rb
CHANGED
@@ -24,6 +24,12 @@ class SpymemcachedRails23Test < Test::Unit::TestCase
|
|
24
24
|
assert @client.stats.values.first
|
25
25
|
end
|
26
26
|
|
27
|
+
def test_rails3_api_compatible
|
28
|
+
@client.set("key1", '0')
|
29
|
+
@client.set("key2", '1')
|
30
|
+
assert_equal({"key1" => '0', 'key2' => '1'}, @client.get_multi(['key1', 'key2'], :raw => true))
|
31
|
+
end
|
32
|
+
|
27
33
|
def response
|
28
34
|
Spymemcached::Rails23::Response
|
29
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spymemcached.jruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.10
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Xiao Li
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|