redis-store 1.1.6 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of redis-store might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG +8 -0
- data/lib/redis-store.rb +1 -0
- data/lib/redis/distributed_store.rb +12 -0
- data/lib/redis/store.rb +2 -1
- data/lib/redis/store/redis_version.rb +14 -0
- data/lib/redis/store/version.rb +1 -1
- data/test/redis/distributed_store_test.rb +14 -0
- data/test/redis/store/redis_version_test.rb +29 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c34d0f4a72ee0603e5b2ef2b95808baac398b667
|
4
|
+
data.tar.gz: e4805c9cd1bfd2cffc6504e36bddf00c80b0ce45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85aa71788df20715c5878ee1b13c047c5904a2b57fb30f4d69e9235dd61692b8f01671ac112f789f9ea6730a8db3cc188226c036188691a563df0e48964a6f90
|
7
|
+
data.tar.gz: 9bebac3bac2a0ee4dc94db6f08325ce707a65ca289f36ad049769ed0cbc0ea6c6eba0f8ce8c0786560242f7b6ba683567743738c1d7897669b3909fffe854368
|
data/CHANGELOG
CHANGED
data/lib/redis-store.rb
CHANGED
@@ -34,6 +34,18 @@ class Redis
|
|
34
34
|
node_for(key).setnx(key, value, options)
|
35
35
|
end
|
36
36
|
|
37
|
+
def redis_version
|
38
|
+
nodes.first.redis_version unless nodes.empty?
|
39
|
+
end
|
40
|
+
|
41
|
+
def supports_redis_version?(version)
|
42
|
+
if nodes.empty?
|
43
|
+
false
|
44
|
+
else
|
45
|
+
nodes.first.supports_redis_version?(version)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
37
49
|
private
|
38
50
|
def _extend_namespace(options)
|
39
51
|
@namespace = options[:namespace]
|
data/lib/redis/store.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
class Redis
|
2
|
+
class Store < self
|
3
|
+
module RedisVersion
|
4
|
+
def redis_version
|
5
|
+
info('server')['redis_version']
|
6
|
+
end
|
7
|
+
|
8
|
+
def supports_redis_version?(version)
|
9
|
+
(redis_version.split(".").map(&:to_i) <=> version.split(".").map(&:to_i)) >= 0
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
data/lib/redis/store/version.rb
CHANGED
@@ -39,6 +39,20 @@ describe "Redis::DistributedStore" do
|
|
39
39
|
@dmr.get("rabbit").must_equal(@rabbit)
|
40
40
|
end
|
41
41
|
|
42
|
+
describe '#redis_version' do
|
43
|
+
it 'returns redis version' do
|
44
|
+
@dmr.nodes.first.expects(:redis_version)
|
45
|
+
@dmr.redis_version
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe '#supports_redis_version?' do
|
50
|
+
it 'returns redis version' do
|
51
|
+
@dmr.nodes.first.expects(:supports_redis_version?).with('2.8.0')
|
52
|
+
@dmr.supports_redis_version?('2.8.0')
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
42
56
|
describe "namespace" do
|
43
57
|
it "uses namespaced key" do
|
44
58
|
@dmr = Redis::DistributedStore.new [
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
describe "Redis::RedisVersion" do
|
4
|
+
def setup
|
5
|
+
@store = Redis::Store.new
|
6
|
+
end
|
7
|
+
|
8
|
+
def teardown
|
9
|
+
@store.quit
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '#redis_version' do
|
13
|
+
it 'returns redis version' do
|
14
|
+
@store.redis_version.to_s.must_match(/^\d{1}\.\d{1,}\.\d{1,}$/)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '#supports_redis_version?' do
|
19
|
+
it 'returns true if redis version is greater or equal to required version' do
|
20
|
+
@store.stubs(:redis_version).returns('2.8.19')
|
21
|
+
@store.supports_redis_version?('2.6.0').must_equal(true)
|
22
|
+
@store.supports_redis_version?('2.8.19').must_equal(true)
|
23
|
+
@store.supports_redis_version?('2.8.20').must_equal(false)
|
24
|
+
@store.supports_redis_version?('2.9.0').must_equal(false)
|
25
|
+
@store.supports_redis_version?('3.0.0').must_equal(false)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -130,6 +130,7 @@ files:
|
|
130
130
|
- lib/redis/store/interface.rb
|
131
131
|
- lib/redis/store/marshalling.rb
|
132
132
|
- lib/redis/store/namespace.rb
|
133
|
+
- lib/redis/store/redis_version.rb
|
133
134
|
- lib/redis/store/ttl.rb
|
134
135
|
- lib/redis/store/version.rb
|
135
136
|
- redis-store.gemspec
|
@@ -138,6 +139,7 @@ files:
|
|
138
139
|
- test/redis/store/interface_test.rb
|
139
140
|
- test/redis/store/marshalling_test.rb
|
140
141
|
- test/redis/store/namespace_test.rb
|
142
|
+
- test/redis/store/redis_version_test.rb
|
141
143
|
- test/redis/store/ttl_test.rb
|
142
144
|
- test/redis/store/version_test.rb
|
143
145
|
- test/redis/store_test.rb
|
@@ -162,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
164
|
version: '0'
|
163
165
|
requirements: []
|
164
166
|
rubyforge_project: redis-store
|
165
|
-
rubygems_version: 2.4.
|
167
|
+
rubygems_version: 2.4.5.1
|
166
168
|
signing_key:
|
167
169
|
specification_version: 4
|
168
170
|
summary: Redis stores for Ruby frameworks
|
@@ -172,6 +174,7 @@ test_files:
|
|
172
174
|
- test/redis/store/interface_test.rb
|
173
175
|
- test/redis/store/marshalling_test.rb
|
174
176
|
- test/redis/store/namespace_test.rb
|
177
|
+
- test/redis/store/redis_version_test.rb
|
175
178
|
- test/redis/store/ttl_test.rb
|
176
179
|
- test/redis/store/version_test.rb
|
177
180
|
- test/redis/store_test.rb
|