remix-stash 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/remix/stash/auto_detection.rb +6 -1
- data/lib/remix/stash/cluster.rb +13 -2
- data/lib/remix/stash/runtime.rb +13 -0
- data/lib/remix/stash.rb +5 -3
- data/remix-stash.gemspec +4 -6
- data/spec/auto_detection_spec.rb +1 -1
- data/spec/support/rails/.gitignore +1 -0
- metadata +4 -6
- data/spec/support/rails/log/development.log +0 -0
- data/spec/support/rails/log/production.log +0 -0
- data/spec/support/rails/log/server.log +0 -0
- data/spec/support/rails/log/test.log +0 -0
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.1
|
@@ -1,5 +1,5 @@
|
|
1
1
|
if defined?(Rails)
|
2
|
-
|
2
|
+
Remix::Stash::Runtime.logger = Rails.logger
|
3
3
|
|
4
4
|
module Remix::Stash::RailsSupport
|
5
5
|
private
|
@@ -25,3 +25,8 @@ if defined?(Rails)
|
|
25
25
|
end
|
26
26
|
|
27
27
|
end
|
28
|
+
|
29
|
+
unless Remix::Stash::Runtime.logger
|
30
|
+
require 'logger'
|
31
|
+
Remix::Stash::Runtime.logger = Logger.new(STDERR)
|
32
|
+
end
|
data/lib/remix/stash/cluster.rb
CHANGED
@@ -4,6 +4,7 @@ require 'digest/md5'
|
|
4
4
|
class Remix::Stash::Cluster
|
5
5
|
include Enumerable
|
6
6
|
include Socket::Constants
|
7
|
+
include Remix::Stash::Runtime
|
7
8
|
|
8
9
|
@@connections = {}
|
9
10
|
|
@@ -24,7 +25,12 @@ class Remix::Stash::Cluster
|
|
24
25
|
rescue Errno::EPIPE, Errno::ECONNRESET, Remix::Stash::ProtocolError
|
25
26
|
io.close
|
26
27
|
retry
|
27
|
-
rescue Errno::EAGAIN
|
28
|
+
rescue Errno::EAGAIN
|
29
|
+
logger.error("[stash] Cluster socket timeout on #{@hosts[(hash + try) % count][0]}")
|
30
|
+
io.close
|
31
|
+
next
|
32
|
+
rescue Errno::ECONNREFUSED
|
33
|
+
logger.error("[stash] Cluster connection refused on #{@hosts[(hash + try) % count][0]}")
|
28
34
|
next
|
29
35
|
end
|
30
36
|
end
|
@@ -48,7 +54,12 @@ class Remix::Stash::Cluster
|
|
48
54
|
rescue Errno::EPIPE, Errno::ECONNRESET, Remix::Stash::ProtocolError
|
49
55
|
io.close
|
50
56
|
retry
|
51
|
-
rescue Errno::EAGAIN
|
57
|
+
rescue Errno::EAGAIN
|
58
|
+
logger.error("[stash] Cluster socket timeout on #{@hosts[(hash + try) % count][0]}")
|
59
|
+
io.close
|
60
|
+
next
|
61
|
+
rescue Errno::ECONNREFUSED
|
62
|
+
logger.error("[stash] Cluster connection refused on #{@hosts[(hash + try) % count][0]}")
|
52
63
|
next
|
53
64
|
end
|
54
65
|
end
|
data/lib/remix/stash.rb
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
module Remix; end
|
2
2
|
|
3
3
|
class Remix::Stash
|
4
|
+
require 'remix/stash/runtime'
|
4
5
|
require 'remix/stash/extension'
|
5
6
|
require 'remix/stash/cluster'
|
6
7
|
require 'remix/stash/protocol'
|
7
8
|
|
9
|
+
include Runtime
|
10
|
+
|
8
11
|
attr_accessor :name
|
9
12
|
|
10
13
|
@@instances = {}
|
@@ -100,7 +103,7 @@ class Remix::Stash
|
|
100
103
|
cluster(opts).select(key) {|io|
|
101
104
|
value = Protocol.get(io, key)
|
102
105
|
if value
|
103
|
-
|
106
|
+
load_value(value)
|
104
107
|
else
|
105
108
|
value = yield(*keys)
|
106
109
|
Protocol.set(io, key, dump_value(value), opts[:ttl])
|
@@ -279,8 +282,7 @@ private
|
|
279
282
|
rescue Exception
|
280
283
|
end
|
281
284
|
end
|
282
|
-
logger
|
283
|
-
logger && logger.error("[stash] Unable to load marshal stream: #{data.inspect}")
|
285
|
+
logger.error("[stash] Unable to load marshal stream: #{data.inspect}")
|
284
286
|
nil
|
285
287
|
end
|
286
288
|
|
data/remix-stash.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{remix-stash}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Brian Mitchell"]
|
12
|
-
s.date = %q{2009-10-
|
12
|
+
s.date = %q{2009-10-06}
|
13
13
|
s.email = %q{binary42@gmail.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE",
|
@@ -36,12 +36,14 @@ Gem::Specification.new do |s|
|
|
36
36
|
"lib/remix/stash/cluster.rb",
|
37
37
|
"lib/remix/stash/extension.rb",
|
38
38
|
"lib/remix/stash/protocol.rb",
|
39
|
+
"lib/remix/stash/runtime.rb",
|
39
40
|
"remix-stash.gemspec",
|
40
41
|
"spec/auto_detection_spec.rb",
|
41
42
|
"spec/extension_spec.rb",
|
42
43
|
"spec/spec.rb",
|
43
44
|
"spec/stash_spec.rb",
|
44
45
|
"spec/support/bar.rb",
|
46
|
+
"spec/support/rails/.gitignore",
|
45
47
|
"spec/support/rails/README",
|
46
48
|
"spec/support/rails/Rakefile",
|
47
49
|
"spec/support/rails/app/controllers/application_controller.rb",
|
@@ -61,10 +63,6 @@ Gem::Specification.new do |s|
|
|
61
63
|
"spec/support/rails/config/routes.rb",
|
62
64
|
"spec/support/rails/db/seeds.rb",
|
63
65
|
"spec/support/rails/doc/README_FOR_APP",
|
64
|
-
"spec/support/rails/log/development.log",
|
65
|
-
"spec/support/rails/log/production.log",
|
66
|
-
"spec/support/rails/log/server.log",
|
67
|
-
"spec/support/rails/log/test.log",
|
68
66
|
"spec/support/rails/public/404.html",
|
69
67
|
"spec/support/rails/public/422.html",
|
70
68
|
"spec/support/rails/public/500.html",
|
data/spec/auto_detection_spec.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
log/*
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remix-stash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Mitchell
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-06 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -43,12 +43,14 @@ files:
|
|
43
43
|
- lib/remix/stash/cluster.rb
|
44
44
|
- lib/remix/stash/extension.rb
|
45
45
|
- lib/remix/stash/protocol.rb
|
46
|
+
- lib/remix/stash/runtime.rb
|
46
47
|
- remix-stash.gemspec
|
47
48
|
- spec/auto_detection_spec.rb
|
48
49
|
- spec/extension_spec.rb
|
49
50
|
- spec/spec.rb
|
50
51
|
- spec/stash_spec.rb
|
51
52
|
- spec/support/bar.rb
|
53
|
+
- spec/support/rails/.gitignore
|
52
54
|
- spec/support/rails/README
|
53
55
|
- spec/support/rails/Rakefile
|
54
56
|
- spec/support/rails/app/controllers/application_controller.rb
|
@@ -68,10 +70,6 @@ files:
|
|
68
70
|
- spec/support/rails/config/routes.rb
|
69
71
|
- spec/support/rails/db/seeds.rb
|
70
72
|
- spec/support/rails/doc/README_FOR_APP
|
71
|
-
- spec/support/rails/log/development.log
|
72
|
-
- spec/support/rails/log/production.log
|
73
|
-
- spec/support/rails/log/server.log
|
74
|
-
- spec/support/rails/log/test.log
|
75
73
|
- spec/support/rails/public/404.html
|
76
74
|
- spec/support/rails/public/422.html
|
77
75
|
- spec/support/rails/public/500.html
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|