redis_failover-rails 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +6 -0
- data/config/redis.yml +5 -0
- data/lib/redis_factory.rb +7 -10
- data/lib/redis_failover-rails/version.rb +1 -1
- data/test/unit/redis_factory_test.rb +6 -3
- 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: 7816addee8e1421a15b6a0d8176030f92c718810
|
4
|
+
data.tar.gz: f0ef36940f3867369442dd776bbe824db1a78aa0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1fc99fccc93225cf92ac299993807ecb5096d7e668c04610cd027f009b79f958321ed4994a9bd7e5eccb5f900d456d2b0aa7de4f223f36b833fdb2cda126720
|
7
|
+
data.tar.gz: c38d3983ac9e2533c99a11ed14db6a73e814c56dbdbfdf74fd5bb5c2ce1beaf17b9187c6cfc272cea51d026c7d8781ac61a77fb69f830f13e77bf36a624e3941
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -125,6 +125,12 @@ Basic `redis.yml` examples:
|
|
125
125
|
db: 1
|
126
126
|
znode_path: /redis_failover #sometimes required...
|
127
127
|
|
128
|
+
## Improved logging
|
129
|
+
Since version 0.2.0 we added an option to use a separate logfile for the logs coming from Redis_Failover. Using the `logfile:` option in the configuration file, the gem just creates a new logfile.
|
130
|
+
|
131
|
+
Just add in redis.yml
|
132
|
+
logfile: redlog.log
|
133
|
+
|
128
134
|
## License
|
129
135
|
This gem is released with MIT licensing. Please see [LICENSE](https://github.com/surfdome/redis_failover-rails/blob/master/LICENSE) for details.
|
130
136
|
|
data/config/redis.yml
CHANGED
@@ -6,6 +6,7 @@ development:
|
|
6
6
|
zkservers: localhost:2181, localhost:2182, localhost:2183
|
7
7
|
znode_path: /redis_failover/nodes
|
8
8
|
db: 1
|
9
|
+
logfile: redlog.log
|
9
10
|
|
10
11
|
production:
|
11
12
|
cache:
|
@@ -13,21 +14,25 @@ production:
|
|
13
14
|
zkservers: localhost:2181, localhost:2182, localhost:2183
|
14
15
|
znode_path: /redis_failover
|
15
16
|
db: 0
|
17
|
+
logfile: redlog.log
|
16
18
|
|
17
19
|
test:
|
18
20
|
hacache:
|
19
21
|
zkservers: localhost:2181
|
20
22
|
db: 8
|
21
23
|
thread_safe: true
|
24
|
+
logfile: redlog.log
|
22
25
|
myredisdb:
|
23
26
|
db: 1
|
24
27
|
host: localhost
|
25
28
|
port: 6379
|
26
29
|
thread_safe: true
|
30
|
+
logfile: redlog.log
|
27
31
|
cache:
|
28
32
|
db: 2
|
29
33
|
host: localhost
|
30
34
|
port: 6379
|
31
35
|
thread_safe: true
|
36
|
+
logfile: redlog.log
|
32
37
|
|
33
38
|
|
data/lib/redis_factory.rb
CHANGED
@@ -24,17 +24,14 @@ class RedisFactory
|
|
24
24
|
conf = configuration[name].symbolize_keys!
|
25
25
|
raise "No redis configuration for #{Rails.env} environment in redis.yml for #{name}" unless conf
|
26
26
|
synchronize do
|
27
|
-
# if conf[:zkservers]
|
28
|
-
# conf[:logger] = logger
|
29
|
-
# @@clients[name] ||= ::RedisFailover::Client.new(
|
30
|
-
# :zkservers => 'localhost:2181,localhost:2182,localhost:2183',
|
31
|
-
# :znode_path => '/redis_failover',
|
32
|
-
# :db => '1')
|
33
|
-
# else
|
34
|
-
# @@clients[name] ||= ::Redis.new()
|
35
|
-
# end
|
36
27
|
if conf[:zkservers]
|
37
|
-
conf[:
|
28
|
+
if conf[:logfile]
|
29
|
+
filelogger = Logger.new(conf[:logfile])
|
30
|
+
conf[:logger] = filelogger
|
31
|
+
else
|
32
|
+
conf[:logger] = logger
|
33
|
+
end
|
34
|
+
|
38
35
|
@@clients[name] ||= ::RedisFailover::Client.new(conf)
|
39
36
|
else
|
40
37
|
@@clients[name] ||= ::Redis.new(conf)
|
@@ -21,16 +21,19 @@ class RedisFactoryTest < ActiveSupport::TestCase
|
|
21
21
|
"db" => 1,
|
22
22
|
"host" => "localhost",
|
23
23
|
"port" => 6379,
|
24
|
-
"thread_safe" => true
|
24
|
+
"thread_safe" => true,
|
25
|
+
"logfile" => "redlog.log"},
|
25
26
|
:cache => {
|
26
27
|
"db" => 2,
|
27
28
|
"host" => "localhost",
|
28
29
|
"port" => 6379,
|
29
|
-
"thread_safe" => true
|
30
|
+
"thread_safe" => true,
|
31
|
+
"logfile" => "redlog.log" },
|
30
32
|
:hacache => {
|
31
33
|
"db" => 8,
|
32
34
|
"thread_safe" => true,
|
33
|
-
"zkservers" => "localhost:2181"
|
35
|
+
"zkservers" => "localhost:2181",
|
36
|
+
"logfile" => "redlog.log" }
|
34
37
|
},
|
35
38
|
RedisFactory.configuration)
|
36
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis_failover-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jose Pettoruti - Surfdome.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis_failover
|