redis-store 1.5.0 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +6 -0
- data/.github/auto-assign-issues.yml +2 -0
- data/.rubocop.yml +138 -0
- data/.travis.yml +25 -21
- data/Appraisals +6 -2
- data/CHANGELOG.md +74 -1
- data/CODEOWNERS +1 -0
- data/README.md +4 -4
- data/Rakefile +2 -0
- data/gemfiles/{redis_3_x.gemfile → redis_4_0_x.gemfile} +1 -1
- data/gemfiles/redis_4_1_x.gemfile +7 -0
- data/lib/redis/distributed_store.rb +5 -5
- data/lib/redis/store.rb +1 -2
- data/lib/redis/store/factory.rb +15 -15
- data/lib/redis/store/interface.rb +9 -1
- data/lib/redis/store/namespace.rb +115 -16
- data/lib/redis/store/redis_version.rb +0 -1
- data/lib/redis/store/ttl.rb +1 -1
- data/lib/redis/store/version.rb +1 -1
- data/redis-store.gemspec +8 -8
- data/test/redis/distributed_store_test.rb +8 -8
- data/test/redis/store/factory_test.rb +49 -17
- data/test/redis/store/interface_test.rb +4 -4
- data/test/redis/store/namespace_test.rb +145 -27
- data/test/redis/store/redis_version_test.rb +1 -2
- data/test/redis/store/serialization_test.rb +4 -4
- data/test/redis/store/ttl_test.rb +20 -2
- data/test/test_helper.rb +1 -1
- metadata +33 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 476790788b3d0462db696bc3773a72c18b3f57f04db394e238bc849b04f6b54a
|
4
|
+
data.tar.gz: 443eca0ff3f6acd16c696aadf4e8cb1c34edf213944d489d66fe6508a5ff2390
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 104215ff505c8dd84b0baac16c99a75e117b33dafbc0f654f6f87acbf0fba1b0a1c34ce3e63530566f65289ca725a98b1e0a640cfc878f33e27fb51857a243df
|
7
|
+
data.tar.gz: 49730d0bc9e9a1295aaa6b410cae27c58838f953a71fb6255c53e27dc4faa670b827effbe2d0f614d4d4dfbe5f91b333465c380db44475c466f261d534e2d91c
|
data/.codeclimate.yml
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
---
|
2
|
+
AllCops:
|
3
|
+
TargetRubyVersion: 2.4
|
4
|
+
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
|
5
|
+
# to ignore them, so only the ones explicitly set in this file are enabled.
|
6
|
+
DisabledByDefault: true
|
7
|
+
Exclude:
|
8
|
+
- '**/vendor/**/*'
|
9
|
+
|
10
|
+
# Prefer &&/|| over and/or.
|
11
|
+
Style/AndOr:
|
12
|
+
Enabled: true
|
13
|
+
|
14
|
+
# Do not use braces for hash literals when they are the last argument of a
|
15
|
+
# method call.
|
16
|
+
Style/BracesAroundHashParameters:
|
17
|
+
Enabled: true
|
18
|
+
EnforcedStyle: context_dependent
|
19
|
+
|
20
|
+
# Align comments with method definitions.
|
21
|
+
Layout/CommentIndentation:
|
22
|
+
Enabled: true
|
23
|
+
|
24
|
+
Layout/ElseAlignment:
|
25
|
+
Enabled: true
|
26
|
+
|
27
|
+
Layout/EmptyLineAfterMagicComment:
|
28
|
+
Enabled: true
|
29
|
+
|
30
|
+
# In a regular class definition, no empty lines around the body.
|
31
|
+
Layout/EmptyLinesAroundClassBody:
|
32
|
+
Enabled: true
|
33
|
+
|
34
|
+
# In a regular method definition, no empty lines around the body.
|
35
|
+
Layout/EmptyLinesAroundMethodBody:
|
36
|
+
Enabled: true
|
37
|
+
|
38
|
+
# In a regular module definition, no empty lines around the body.
|
39
|
+
Layout/EmptyLinesAroundModuleBody:
|
40
|
+
Enabled: true
|
41
|
+
|
42
|
+
Layout/FirstParameterIndentation:
|
43
|
+
Enabled: true
|
44
|
+
|
45
|
+
# Method definitions after `private` or `protected` isolated calls need one
|
46
|
+
# extra level of indentation.
|
47
|
+
Layout/IndentationConsistency:
|
48
|
+
Enabled: true
|
49
|
+
EnforcedStyle: rails
|
50
|
+
|
51
|
+
# Two spaces, no tabs (for indentation).
|
52
|
+
Layout/IndentationWidth:
|
53
|
+
Enabled: true
|
54
|
+
|
55
|
+
Layout/LeadingCommentSpace:
|
56
|
+
Enabled: true
|
57
|
+
|
58
|
+
Layout/SpaceAfterColon:
|
59
|
+
Enabled: true
|
60
|
+
|
61
|
+
Layout/SpaceAfterComma:
|
62
|
+
Enabled: true
|
63
|
+
|
64
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
65
|
+
Enabled: true
|
66
|
+
|
67
|
+
Layout/SpaceAroundKeyword:
|
68
|
+
Enabled: true
|
69
|
+
|
70
|
+
Layout/SpaceAroundOperators:
|
71
|
+
Enabled: true
|
72
|
+
|
73
|
+
Layout/SpaceBeforeComma:
|
74
|
+
Enabled: true
|
75
|
+
|
76
|
+
Layout/SpaceBeforeFirstArg:
|
77
|
+
Enabled: true
|
78
|
+
|
79
|
+
Style/DefWithParentheses:
|
80
|
+
Enabled: true
|
81
|
+
|
82
|
+
# Defining a method with parameters needs parentheses.
|
83
|
+
Style/MethodDefParentheses:
|
84
|
+
Enabled: true
|
85
|
+
|
86
|
+
# Use `foo {}` not `foo{}`.
|
87
|
+
Layout/SpaceBeforeBlockBraces:
|
88
|
+
Enabled: true
|
89
|
+
|
90
|
+
# Use `foo { bar }` not `foo {bar}`.
|
91
|
+
Layout/SpaceInsideBlockBraces:
|
92
|
+
Enabled: true
|
93
|
+
|
94
|
+
# Use `{ a: 1 }` not `{a:1}`.
|
95
|
+
Layout/SpaceInsideHashLiteralBraces:
|
96
|
+
Enabled: true
|
97
|
+
|
98
|
+
Layout/SpaceInsideParens:
|
99
|
+
Enabled: true
|
100
|
+
|
101
|
+
# Detect hard tabs, no hard tabs.
|
102
|
+
Layout/Tab:
|
103
|
+
Enabled: true
|
104
|
+
|
105
|
+
# Blank lines should not have any spaces.
|
106
|
+
Layout/TrailingBlankLines:
|
107
|
+
Enabled: true
|
108
|
+
|
109
|
+
# No trailing whitespace.
|
110
|
+
Layout/TrailingWhitespace:
|
111
|
+
Enabled: true
|
112
|
+
|
113
|
+
# Use quotes for string literals when they are enough.
|
114
|
+
Style/UnneededPercentQ:
|
115
|
+
Enabled: true
|
116
|
+
|
117
|
+
# Align `end` with the matching keyword or starting expression except for
|
118
|
+
# assignments, where it should be aligned with the LHS.
|
119
|
+
Layout/EndAlignment:
|
120
|
+
Enabled: true
|
121
|
+
EnforcedStyleAlignWith: variable
|
122
|
+
AutoCorrect: true
|
123
|
+
|
124
|
+
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
125
|
+
Lint/RequireParentheses:
|
126
|
+
Enabled: true
|
127
|
+
|
128
|
+
Style/RedundantReturn:
|
129
|
+
Enabled: true
|
130
|
+
AllowMultipleReturnValues: true
|
131
|
+
|
132
|
+
Style/Semicolon:
|
133
|
+
Enabled: true
|
134
|
+
AllowAsExpressionSeparator: true
|
135
|
+
|
136
|
+
# Prefer Foo.method over Foo::method
|
137
|
+
Style/ColonMethodCall:
|
138
|
+
Enabled: true
|
data/.travis.yml
CHANGED
@@ -4,32 +4,36 @@ cache: bundler
|
|
4
4
|
notifications:
|
5
5
|
webhooks: https://www.travisbuddy.com
|
6
6
|
on_success: never
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
before_install:
|
8
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
|
9
|
+
> ./cc-test-reporter
|
10
|
+
- chmod +x ./cc-test-reporter
|
11
11
|
rvm:
|
12
|
-
- 1.9.3
|
13
|
-
- 2.0
|
14
|
-
- 2.1
|
15
|
-
- 2.2
|
16
12
|
- 2.3
|
17
13
|
- 2.4
|
14
|
+
- 2.5
|
15
|
+
- 2.6
|
16
|
+
- 2.7
|
18
17
|
- ruby-head
|
19
18
|
- jruby-head
|
20
|
-
|
21
19
|
gemfile:
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
- gemfiles/redis_4_0_x.gemfile
|
21
|
+
- gemfiles/redis_4_1_x.gemfile
|
22
|
+
- gemfiles/redis_4_x.gemfile
|
23
|
+
before_script: "./cc-test-reporter before-build"
|
24
|
+
after_script:
|
25
|
+
- "./cc-test-reporter after-build --exit-code $EXIT_CODE"
|
26
|
+
- "./cc-test-reporter format-coverage -t simplecov -o coverage/codeclimate.json"
|
27
|
+
- if [[ "$TRAVIS_TEST_RESULT" == 0 ]]; then ./cc-test-reporter upload-coverage; fi
|
25
28
|
matrix:
|
26
29
|
allow_failures:
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
30
|
+
- rvm: jruby-head
|
31
|
+
- rvm: ruby-head
|
32
|
+
deploy:
|
33
|
+
provider: rubygems
|
34
|
+
api_key:
|
35
|
+
secure: vhwP2VNfVYgppPNis7asqMnWuIcURr2e99uhYeHS4Sc+hIozu2QzAAekDrVpEDpeaEubtmTi19UcV4dZbDrQ0M+buE8LJEpItz73yK++J75Rzyh/bsGnWTy2FIvedLrH+jBNf28I9p8XNWkQxVaTc/r/v6BX3mmyV/jVoTBz9es=
|
36
|
+
gem: redis-store
|
37
|
+
on:
|
38
|
+
tags: true
|
39
|
+
repo: redis-store/redis-store
|
data/Appraisals
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,78 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.9.0
|
4
|
+
|
5
|
+
Breaking Changes
|
6
|
+
|
7
|
+
* As a factor of updates for Redis v4.2.x, support for Ruby 2.1 and 2.2
|
8
|
+
has been dropped. These Ruby versions are end-of-life anyway.
|
9
|
+
|
10
|
+
Fixed
|
11
|
+
|
12
|
+
* [Compatibility with Redis client v4.2.x](https://github.com/redis-store/redis-store/pull/333)
|
13
|
+
|
14
|
+
Added
|
15
|
+
|
16
|
+
* [Support for edge Ruby's keyword arguments](https://github.com/redis-store/redis-store/pull/334)
|
17
|
+
|
18
|
+
## 1.8.2
|
19
|
+
|
20
|
+
Breaking Changes
|
21
|
+
|
22
|
+
* None
|
23
|
+
|
24
|
+
Added
|
25
|
+
|
26
|
+
* [Add namespace to zincrby and zscore](https://github.com/redis-store/redis-store/pull/323)
|
27
|
+
* [Add namespace to zadd and zrem](https://github.com/redis-store/redis-store/pull/326)
|
28
|
+
|
29
|
+
Fixed
|
30
|
+
|
31
|
+
* None
|
32
|
+
|
33
|
+
## 1.8.1
|
34
|
+
|
35
|
+
Breaking Changes
|
36
|
+
|
37
|
+
* None
|
38
|
+
|
39
|
+
Added
|
40
|
+
|
41
|
+
* None
|
42
|
+
|
43
|
+
Fixed
|
44
|
+
|
45
|
+
* [Add namespace to remaining hash methods](https://github.com/redis-store/redis-store/pull/321)
|
46
|
+
|
47
|
+
## 1.8.0
|
48
|
+
|
49
|
+
Breaking Changes
|
50
|
+
|
51
|
+
* None
|
52
|
+
|
53
|
+
Added
|
54
|
+
|
55
|
+
* [Redis Cluster Support](https://github.com/redis-store/redis-store/pull/318)
|
56
|
+
|
57
|
+
Fixed
|
58
|
+
|
59
|
+
* None
|
60
|
+
|
61
|
+
## 1.6.0
|
62
|
+
|
63
|
+
Breaking Changes
|
64
|
+
|
65
|
+
* None
|
66
|
+
|
67
|
+
Added
|
68
|
+
|
69
|
+
* [SSL/TLS Support with the rediss:// URI scheme](https://github.com/redis-store/redis-store/pull/306)
|
70
|
+
* [Use Code Style Guide For New Contributions](https://github.com/redis-store/redis-store/pull/309)
|
71
|
+
|
72
|
+
Fixed
|
73
|
+
|
74
|
+
* None
|
75
|
+
|
3
76
|
## 1.5.0
|
4
77
|
|
5
78
|
Breaking Changes
|
@@ -44,7 +117,7 @@ Added
|
|
44
117
|
|
45
118
|
Fixed
|
46
119
|
|
47
|
-
* Conventional `Marshal.dump` usage allowing potential security vulnerability (CVE-2017-1000248)
|
120
|
+
* Conventional `Marshal.dump` usage allowing potential security vulnerability (CVE-2017-1000248)
|
48
121
|
|
49
122
|
## 1.3.0
|
50
123
|
|
data/CODEOWNERS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* @tubbo
|
data/README.md
CHANGED
@@ -23,7 +23,7 @@ Download and install Redis from [the download page](http://redis.io//download) a
|
|
23
23
|
```ruby
|
24
24
|
git clone git://github.com/redis-store/redis-store.git
|
25
25
|
cd redis-store
|
26
|
-
|
26
|
+
bundle install
|
27
27
|
bundle exec rake
|
28
28
|
```
|
29
29
|
|
@@ -45,9 +45,9 @@ s.add_dependency 'redis-store', '>= 1.4', '< 2'
|
|
45
45
|
|
46
46
|
## Status
|
47
47
|
|
48
|
-
[![Gem Version](https://badge.fury.io/rb/redis-store.
|
49
|
-
[![Build Status](https://secure.travis-ci.org/redis-store/redis-store.
|
50
|
-
[![Code Climate](https://codeclimate.com/github/redis-store/redis-store.
|
48
|
+
[![Gem Version](https://badge.fury.io/rb/redis-store.svg)](http://badge.fury.io/rb/redis-store)
|
49
|
+
[![Build Status](https://secure.travis-ci.org/redis-store/redis-store.svg?branch=master)](http://travis-ci.org/redis-store/redis-store?branch=master)
|
50
|
+
[![Code Climate](https://codeclimate.com/github/redis-store/redis-store.svg)](https://codeclimate.com/github/redis-store/redis-store)
|
51
51
|
|
52
52
|
## Copyright
|
53
53
|
|
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ class Redis
|
|
5
5
|
@@timeout = 5
|
6
6
|
attr_reader :ring
|
7
7
|
|
8
|
-
def initialize(addresses, options = {
|
8
|
+
def initialize(addresses, options = {})
|
9
9
|
_extend_namespace options
|
10
10
|
@ring = options[:ring] || Redis::HashRing.new([], options[:replicas] || Redis::HashRing::POINTS_PER_SERVER)
|
11
11
|
|
@@ -19,7 +19,7 @@ class Redis
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def reconnect
|
22
|
-
nodes.each {|node| node.reconnect }
|
22
|
+
nodes.each { |node| node.reconnect }
|
23
23
|
end
|
24
24
|
|
25
25
|
def set(key, value, options = nil)
|
@@ -57,10 +57,10 @@ class Redis
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def _merge_options(address, options)
|
60
|
-
address.merge(
|
61
|
-
:timeout => options[:timeout] || @@timeout,
|
60
|
+
address.merge(
|
61
|
+
:timeout => options[:timeout] || @@timeout,
|
62
62
|
:namespace => options[:namespace]
|
63
|
-
|
63
|
+
)
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
data/lib/redis/store.rb
CHANGED
data/lib/redis/store/factory.rb
CHANGED
@@ -3,7 +3,6 @@ require 'uri'
|
|
3
3
|
class Redis
|
4
4
|
class Store < self
|
5
5
|
class Factory
|
6
|
-
|
7
6
|
DEFAULT_PORT = 6379
|
8
7
|
|
9
8
|
def self.create(*options)
|
@@ -41,7 +40,7 @@ class Redis
|
|
41
40
|
if host_options?(options)
|
42
41
|
options
|
43
42
|
else
|
44
|
-
nil
|
43
|
+
nil
|
45
44
|
end
|
46
45
|
end
|
47
46
|
|
@@ -57,12 +56,12 @@ class Redis
|
|
57
56
|
!options[:marshalling]
|
58
57
|
else
|
59
58
|
false
|
60
|
-
|
59
|
+
end
|
61
60
|
options
|
62
61
|
end
|
63
62
|
|
64
63
|
def self.host_options?(options)
|
65
|
-
options.keys.any? {|n| [:host, :db, :port, :path].include?(n) }
|
64
|
+
options.keys.any? { |n| [:host, :db, :port, :path].include?(n) }
|
66
65
|
end
|
67
66
|
|
68
67
|
def self.extract_host_options_from_uri(uri)
|
@@ -71,13 +70,14 @@ class Redis
|
|
71
70
|
options = { :path => uri.path }
|
72
71
|
else
|
73
72
|
_, db, namespace = if uri.path
|
74
|
-
|
75
|
-
|
73
|
+
uri.path.split(/\//)
|
74
|
+
end
|
76
75
|
|
77
76
|
options = {
|
77
|
+
:scheme => uri.scheme,
|
78
78
|
:host => uri.hostname,
|
79
79
|
:port => uri.port || DEFAULT_PORT,
|
80
|
-
:password => uri.password.nil? ? nil : CGI
|
80
|
+
:password => uri.password.nil? ? nil : CGI.unescape(uri.password.to_s)
|
81
81
|
}
|
82
82
|
|
83
83
|
options[:db] = db.to_i if db
|
@@ -95,16 +95,16 @@ class Redis
|
|
95
95
|
|
96
96
|
private
|
97
97
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
98
|
+
def extract_addresses_and_options(*options)
|
99
|
+
options.flatten.compact.each do |token|
|
100
|
+
resolved = self.class.resolve(token)
|
101
|
+
if resolved
|
102
|
+
@addresses << resolved
|
103
|
+
else
|
104
|
+
@options.merge!(self.class.normalize_key_names(token))
|
105
|
+
end
|
105
106
|
end
|
106
107
|
end
|
107
|
-
end
|
108
108
|
end
|
109
109
|
end
|
110
110
|
end
|