redis-store 1.0.0.beta4 → 1.0.0.beta5
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.
- data/CHANGELOG +9 -0
- data/Gemfile +7 -6
- data/Gemfile.lock +8 -8
- data/README.md +20 -10
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/lib/active_support/cache/redis_store.rb +11 -0
- data/lib/cache/sinatra/redis_store.rb +1 -0
- data/lib/redis/distributed_store.rb +4 -0
- data/lib/redis/store.rb +4 -0
- data/lib/redis/store/namespace.rb +10 -2
- data/lib/redis/store/version.rb +1 -1
- data/redis-store.gemspec +10 -11
- data/spec/active_support/cache/redis_store_spec.rb +6 -0
- data/spec/config/{master.conf → node-one.conf} +115 -10
- data/spec/config/{slave.conf → node-two.conf} +116 -11
- data/spec/config/{single.conf → redis.conf} +114 -9
- data/spec/i18n/backend/redis_spec.rb +22 -6
- data/spec/redis/distributed_store_spec.rb +8 -0
- data/spec/redis/store/namespace_spec.rb +2 -2
- data/spec/redis/store/version_spec.rb +1 -1
- data/spec/redis/store_spec.rb +13 -0
- data/tasks/redis.tasks.rb +27 -19
- metadata +24 -36
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Redis::Store" do
|
4
|
+
before :each do
|
5
|
+
@store = Redis::Store.new
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should force reconnection" do
|
9
|
+
client = @store.instance_variable_get(:@client)
|
10
|
+
client.should_receive(:reconnect)
|
11
|
+
@store.reconnect
|
12
|
+
end
|
13
|
+
end
|
data/tasks/redis.tasks.rb
CHANGED
@@ -40,23 +40,23 @@ class RedisRunner
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def self.stop
|
43
|
-
system %(
|
43
|
+
system %(redis-cli -p #{port} SHUTDOWN)
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
class
|
47
|
+
class MainRedisRunner < RedisRunner
|
48
48
|
def self.redisconfdir
|
49
|
-
File.expand_path(File.dirname(__FILE__) + "/../spec/config/
|
49
|
+
File.expand_path(File.dirname(__FILE__) + "/../spec/config/redis.conf")
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
class
|
53
|
+
class NodeOneRedisRunner < RedisRunner
|
54
54
|
def self.redisconfdir
|
55
|
-
File.expand_path(File.dirname(__FILE__) + "/../spec/config/
|
55
|
+
File.expand_path(File.dirname(__FILE__) + "/../spec/config/node-one.conf")
|
56
56
|
end
|
57
57
|
|
58
58
|
def self.dtach_socket
|
59
|
-
"/tmp/
|
59
|
+
"/tmp/redis-node-one.dtach"
|
60
60
|
end
|
61
61
|
|
62
62
|
def self.port
|
@@ -64,13 +64,13 @@ class MasterRedisRunner < RedisRunner
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
class
|
67
|
+
class NodeTwoRedisRunner < RedisRunner
|
68
68
|
def self.redisconfdir
|
69
|
-
File.expand_path(File.dirname(__FILE__) + "/../spec/config/
|
69
|
+
File.expand_path(File.dirname(__FILE__) + "/../spec/config/node-two.conf")
|
70
70
|
end
|
71
71
|
|
72
72
|
def self.dtach_socket
|
73
|
-
"/tmp/
|
73
|
+
"/tmp/redis-node-two.dtach"
|
74
74
|
end
|
75
75
|
|
76
76
|
def self.port
|
@@ -78,9 +78,9 @@ class SlaveRedisRunner < RedisRunner
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
-
class
|
81
|
+
class RedisReplicationRunner
|
82
82
|
def self.runners
|
83
|
-
[
|
83
|
+
[ MainRedisRunner, NodeOneRedisRunner, NodeTwoRedisRunner ]
|
84
84
|
end
|
85
85
|
|
86
86
|
def self.start_detached
|
@@ -154,6 +154,7 @@ namespace :redis do
|
|
154
154
|
|
155
155
|
commit = case ENV['VERSION']
|
156
156
|
when "1.2.6" then "570e43c8285a4e5e3f31"
|
157
|
+
when "2.2.2" then "048c0f0f37a67f3f33bd"
|
157
158
|
end
|
158
159
|
|
159
160
|
arguments = commit.nil? ? "pull origin master" : "reset --hard #{commit}"
|
@@ -167,16 +168,23 @@ namespace :redis do
|
|
167
168
|
RedisRunner.stop
|
168
169
|
end
|
169
170
|
|
170
|
-
namespace :
|
171
|
-
desc "Starts
|
171
|
+
namespace :replication do
|
172
|
+
desc "Starts redis replication servers"
|
172
173
|
task :start do
|
173
|
-
result =
|
174
|
+
result = RedisReplicationRunner.start_detached
|
174
175
|
raise("Could not start redis-server, aborting.") unless result
|
175
176
|
end
|
176
177
|
|
177
|
-
desc "Stops
|
178
|
+
desc "Stops redis replication servers"
|
178
179
|
task :stop do
|
179
|
-
|
180
|
+
RedisReplicationRunner.stop
|
181
|
+
end
|
182
|
+
|
183
|
+
desc "Open an IRb session with the master/slave replication"
|
184
|
+
task :console do
|
185
|
+
RedisReplicationRunner.start_detached
|
186
|
+
system "bundle exec irb -I lib -I extra -r redis-store.rb"
|
187
|
+
RedisReplicationRunner.stop
|
180
188
|
end
|
181
189
|
end
|
182
190
|
end
|
@@ -210,11 +218,11 @@ namespace :dtach do
|
|
210
218
|
end
|
211
219
|
end
|
212
220
|
|
213
|
-
def
|
221
|
+
def invoke_with_redis_replication(task_name)
|
214
222
|
begin
|
215
|
-
Rake::Task["redis:
|
223
|
+
Rake::Task["redis:replication:start"].invoke
|
216
224
|
Rake::Task[task_name].invoke
|
217
225
|
ensure
|
218
|
-
Rake::Task["redis:
|
226
|
+
Rake::Task["redis:replication:stop"].invoke
|
219
227
|
end
|
220
228
|
end
|
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
|
-
hash: -
|
4
|
+
hash: -1848230055
|
5
5
|
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
version: 1.0.0.
|
10
|
+
- beta5
|
11
|
+
version: 1.0.0.beta5
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Luca Guidi
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date:
|
19
|
+
date: 2011-04-02 00:00:00 +02:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -25,14 +25,14 @@ dependencies:
|
|
25
25
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
26
|
none: false
|
27
27
|
requirements:
|
28
|
-
- -
|
28
|
+
- - ~>
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
hash:
|
30
|
+
hash: 7
|
31
31
|
segments:
|
32
32
|
- 2
|
33
|
+
- 2
|
33
34
|
- 0
|
34
|
-
|
35
|
-
version: 2.0.0
|
35
|
+
version: 2.2.0
|
36
36
|
type: :runtime
|
37
37
|
version_requirements: *id001
|
38
38
|
- !ruby/object:Gem::Dependency
|
@@ -64,7 +64,7 @@ dependencies:
|
|
64
64
|
type: :development
|
65
65
|
version_requirements: *id003
|
66
66
|
- !ruby/object:Gem::Dependency
|
67
|
-
name: rack
|
67
|
+
name: rack-cache
|
68
68
|
prerelease: false
|
69
69
|
requirement: &id004 !ruby/object:Gem::Requirement
|
70
70
|
none: false
|
@@ -77,24 +77,10 @@ dependencies:
|
|
77
77
|
version: "0"
|
78
78
|
type: :development
|
79
79
|
version_requirements: *id004
|
80
|
-
- !ruby/object:Gem::Dependency
|
81
|
-
name: rack-cache
|
82
|
-
prerelease: false
|
83
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
84
|
-
none: false
|
85
|
-
requirements:
|
86
|
-
- - ">="
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
hash: 3
|
89
|
-
segments:
|
90
|
-
- 0
|
91
|
-
version: "0"
|
92
|
-
type: :development
|
93
|
-
version_requirements: *id005
|
94
80
|
- !ruby/object:Gem::Dependency
|
95
81
|
name: merb
|
96
82
|
prerelease: false
|
97
|
-
requirement: &
|
83
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
98
84
|
none: false
|
99
85
|
requirements:
|
100
86
|
- - "="
|
@@ -106,11 +92,11 @@ dependencies:
|
|
106
92
|
- 0
|
107
93
|
version: 1.1.0
|
108
94
|
type: :development
|
109
|
-
version_requirements: *
|
95
|
+
version_requirements: *id005
|
110
96
|
- !ruby/object:Gem::Dependency
|
111
97
|
name: rspec
|
112
98
|
prerelease: false
|
113
|
-
requirement: &
|
99
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
114
100
|
none: false
|
115
101
|
requirements:
|
116
102
|
- - "="
|
@@ -122,11 +108,11 @@ dependencies:
|
|
122
108
|
- 0
|
123
109
|
version: 1.3.0
|
124
110
|
type: :development
|
125
|
-
version_requirements: *
|
111
|
+
version_requirements: *id006
|
126
112
|
- !ruby/object:Gem::Dependency
|
127
113
|
name: i18n
|
128
114
|
prerelease: false
|
129
|
-
requirement: &
|
115
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
130
116
|
none: false
|
131
117
|
requirements:
|
132
118
|
- - ">="
|
@@ -136,11 +122,11 @@ dependencies:
|
|
136
122
|
- 0
|
137
123
|
version: "0"
|
138
124
|
type: :development
|
139
|
-
version_requirements: *
|
125
|
+
version_requirements: *id007
|
140
126
|
- !ruby/object:Gem::Dependency
|
141
127
|
name: ruby-debug
|
142
128
|
prerelease: false
|
143
|
-
requirement: &
|
129
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
144
130
|
none: false
|
145
131
|
requirements:
|
146
132
|
- - ">="
|
@@ -150,11 +136,11 @@ dependencies:
|
|
150
136
|
- 0
|
151
137
|
version: "0"
|
152
138
|
type: :development
|
153
|
-
version_requirements: *
|
139
|
+
version_requirements: *id008
|
154
140
|
- !ruby/object:Gem::Dependency
|
155
141
|
name: redis
|
156
142
|
prerelease: false
|
157
|
-
requirement: &
|
143
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
158
144
|
none: false
|
159
145
|
requirements:
|
160
146
|
- - ">="
|
@@ -166,7 +152,7 @@ dependencies:
|
|
166
152
|
- 0
|
167
153
|
version: 2.0.0
|
168
154
|
type: :runtime
|
169
|
-
version_requirements: *
|
155
|
+
version_requirements: *id009
|
170
156
|
description: Namespaced Rack::Session, Rack::Cache, I18n and cache Redis stores for Ruby web frameworks.
|
171
157
|
email: guidi.luca@gmail.com
|
172
158
|
executables: []
|
@@ -206,9 +192,9 @@ files:
|
|
206
192
|
- spec/active_support/cache/redis_store_spec.rb
|
207
193
|
- spec/cache/merb/redis_store_spec.rb
|
208
194
|
- spec/cache/sinatra/redis_store_spec.rb
|
209
|
-
- spec/config/
|
210
|
-
- spec/config/
|
211
|
-
- spec/config/
|
195
|
+
- spec/config/node-one.conf
|
196
|
+
- spec/config/node-two.conf
|
197
|
+
- spec/config/redis.conf
|
212
198
|
- spec/i18n/backend/redis_spec.rb
|
213
199
|
- spec/rack/cache/entitystore/pony.jpg
|
214
200
|
- spec/rack/cache/entitystore/redis_spec.rb
|
@@ -220,6 +206,7 @@ files:
|
|
220
206
|
- spec/redis/store/marshalling_spec.rb
|
221
207
|
- spec/redis/store/namespace_spec.rb
|
222
208
|
- spec/redis/store/version_spec.rb
|
209
|
+
- spec/redis/store_spec.rb
|
223
210
|
- spec/spec_helper.rb
|
224
211
|
- tasks/redis.tasks.rb
|
225
212
|
has_rdoc: true
|
@@ -273,4 +260,5 @@ test_files:
|
|
273
260
|
- spec/redis/store/marshalling_spec.rb
|
274
261
|
- spec/redis/store/namespace_spec.rb
|
275
262
|
- spec/redis/store/version_spec.rb
|
263
|
+
- spec/redis/store_spec.rb
|
276
264
|
- spec/spec_helper.rb
|