redis-store 1.0.0.beta3 → 1.0.0.beta4
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 +14 -0
- data/Gemfile +5 -5
- data/Gemfile.lock +19 -22
- data/README.md +55 -9
- data/VERSION +1 -1
- data/lib/action_controller/session/redis_session_store.rb +13 -13
- data/lib/active_support/cache/redis_store.rb +49 -25
- data/lib/rack/cache/redis_entitystore.rb +1 -1
- data/lib/rack/cache/redis_metastore.rb +1 -1
- data/lib/rack/session/redis.rb +1 -1
- data/lib/redis-store.rb +3 -2
- data/lib/redis/factory.rb +3 -3
- data/lib/redis/store.rb +1 -1
- data/lib/redis/store/version.rb +1 -1
- data/redis-store.gemspec +90 -65
- data/spec/action_controller/session/redis_session_store_spec.rb +8 -3
- data/spec/rack/cache/entitystore/redis_spec.rb +4 -0
- data/spec/rack/cache/metastore/redis_spec.rb +4 -0
- data/spec/redis/store/version_spec.rb +1 -1
- data/spec/spec_helper.rb +5 -1
- metadata +138 -7
- data/.gitignore +0 -11
data/CHANGELOG
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
*1.0.0 [beta4] (December 15, 2010)*
|
2
|
+
|
3
|
+
* Bump version v1.0.0.beta4
|
4
|
+
* Force Rails cache store when ActiveSupport is detected
|
5
|
+
* Make sure to accept options when :servers isn't passed
|
6
|
+
* Always force session store loading when using Rails
|
7
|
+
* Make it compatible with Rails 3 sessions store [Andre Medeiros]
|
8
|
+
* Better Rails 3 detection [Andre Medeiros]
|
9
|
+
* Added support for password in Redis URI resolution [Jacob Gyllenstierna]
|
10
|
+
* fix deleting values from session hash [Calvin Yu]
|
11
|
+
* Use defensive design when build options for a store
|
12
|
+
* ActiveSupport cache store doesn't accept any argument in Rails 2
|
13
|
+
* Updated dependencies
|
14
|
+
|
1
15
|
*1.0.0 [beta3] (September 10, 2010)*
|
2
16
|
|
3
17
|
* Bump version v1.0.0.beta3
|
data/Gemfile
CHANGED
@@ -8,9 +8,9 @@ end
|
|
8
8
|
|
9
9
|
group :development, :test, :rails3 do
|
10
10
|
gem "rack"
|
11
|
-
gem "rspec"
|
12
11
|
gem "rack-cache"
|
13
12
|
gem "merb", "1.1.0"
|
13
|
+
gem "rspec", "1.3.0"
|
14
14
|
gem "i18n"
|
15
15
|
|
16
16
|
if RUBY_VERSION > '1.9'
|
@@ -22,12 +22,12 @@ end
|
|
22
22
|
|
23
23
|
if ENV["REDIS_STORE_ENV"] == "rails3"
|
24
24
|
group :rails3 do
|
25
|
-
gem "activesupport", "3.0.
|
26
|
-
gem "actionpack", "3.0.
|
25
|
+
gem "activesupport", "3.0.3"
|
26
|
+
gem "actionpack", "3.0.3"
|
27
27
|
end
|
28
28
|
else
|
29
29
|
group :test do
|
30
|
-
gem "activesupport", "2.3.
|
31
|
-
gem "actionpack", "2.3.
|
30
|
+
gem "activesupport", "2.3.10"
|
31
|
+
gem "actionpack", "2.3.10"
|
32
32
|
end
|
33
33
|
end
|
data/Gemfile.lock
CHANGED
@@ -6,15 +6,15 @@ GEM
|
|
6
6
|
sexp_processor (>= 3.0.0)
|
7
7
|
RubyInline (3.8.6)
|
8
8
|
ZenTest (~> 4.3)
|
9
|
-
ZenTest (4.4.
|
9
|
+
ZenTest (4.4.2)
|
10
10
|
abstract (1.0.0)
|
11
|
-
actionpack (2.3.
|
12
|
-
activesupport (= 2.3.
|
11
|
+
actionpack (2.3.10)
|
12
|
+
activesupport (= 2.3.10)
|
13
13
|
rack (~> 1.1.0)
|
14
|
-
activesupport (2.3.
|
15
|
-
addressable (2.2.
|
14
|
+
activesupport (2.3.10)
|
15
|
+
addressable (2.2.2)
|
16
16
|
bcrypt-ruby (2.1.2)
|
17
|
-
columnize (0.3.
|
17
|
+
columnize (0.3.2)
|
18
18
|
data_objects (0.10.2)
|
19
19
|
addressable (~> 2.1)
|
20
20
|
diff-lcs (1.1.2)
|
@@ -51,15 +51,14 @@ GEM
|
|
51
51
|
abstract (>= 1.0.0)
|
52
52
|
extlib (0.9.15)
|
53
53
|
fastercsv (1.5.3)
|
54
|
-
gemcutter (0.6.1)
|
55
54
|
git (1.2.5)
|
56
|
-
haml (3.0.
|
55
|
+
haml (3.0.24)
|
57
56
|
highline (1.6.1)
|
58
|
-
i18n (0.
|
59
|
-
jeweler (1.
|
60
|
-
|
57
|
+
i18n (0.5.0)
|
58
|
+
jeweler (1.5.1)
|
59
|
+
bundler (~> 1.0.0)
|
61
60
|
git (>= 1.2.5)
|
62
|
-
|
61
|
+
rake
|
63
62
|
json_pure (1.2.4)
|
64
63
|
linecache (0.43)
|
65
64
|
mailfactory (1.4.0)
|
@@ -139,25 +138,23 @@ GEM
|
|
139
138
|
merb-core (~> 1.1.0)
|
140
139
|
mime-types (1.16)
|
141
140
|
rack (1.1.0)
|
142
|
-
rack-cache (0.5.
|
141
|
+
rack-cache (0.5.3)
|
143
142
|
rack (>= 0.4)
|
144
143
|
rake (0.8.7)
|
145
144
|
randexp (0.1.5)
|
146
145
|
ParseTree
|
147
|
-
redis (2.
|
146
|
+
redis (2.1.1)
|
148
147
|
rspec (1.3.0)
|
149
|
-
ruby-debug (0.10.
|
148
|
+
ruby-debug (0.10.4)
|
150
149
|
columnize (>= 0.1)
|
151
|
-
ruby-debug-base (~> 0.10.
|
152
|
-
ruby-debug-base (0.10.
|
150
|
+
ruby-debug-base (~> 0.10.4.0)
|
151
|
+
ruby-debug-base (0.10.4)
|
153
152
|
linecache (>= 0.3)
|
154
153
|
ruby2ruby (1.2.5)
|
155
154
|
ruby_parser (~> 2.0)
|
156
155
|
sexp_processor (~> 3.0)
|
157
156
|
ruby_parser (2.0.5)
|
158
157
|
sexp_processor (~> 3.0)
|
159
|
-
rubyforge (2.0.4)
|
160
|
-
json_pure (>= 1.1.7)
|
161
158
|
sexp_processor (3.0.5)
|
162
159
|
stringex (1.1.0)
|
163
160
|
templater (1.0.0)
|
@@ -170,8 +167,8 @@ PLATFORMS
|
|
170
167
|
ruby
|
171
168
|
|
172
169
|
DEPENDENCIES
|
173
|
-
actionpack (= 2.3.
|
174
|
-
activesupport (= 2.3.
|
170
|
+
actionpack (= 2.3.10)
|
171
|
+
activesupport (= 2.3.10)
|
175
172
|
git
|
176
173
|
i18n
|
177
174
|
jeweler
|
@@ -179,5 +176,5 @@ DEPENDENCIES
|
|
179
176
|
rack
|
180
177
|
rack-cache
|
181
178
|
redis (>= 2.0.0)
|
182
|
-
rspec
|
179
|
+
rspec (= 1.3.0)
|
183
180
|
ruby-debug
|
data/README.md
CHANGED
@@ -29,13 +29,13 @@ By default each store try to connect on `localhost` with the port `6379` and the
|
|
29
29
|
password: secret
|
30
30
|
|
31
31
|
If you want to specify the `namespace` optional, you have to pass the `db` param too.
|
32
|
-
#### __Important__: for now (
|
32
|
+
#### __Important__: for now (beta4) `namespace` is only supported for single, non-distributed stores.
|
33
33
|
|
34
34
|
### Hash
|
35
35
|
|
36
36
|
{ :host => 192.168.1.100, :port => 23682, :db => 13, :namespace => "theplaylist", :password => "secret" }
|
37
37
|
|
38
|
-
#### __Important__: for now (
|
38
|
+
#### __Important__: for now (beta4) `namespace` is only supported for single, non-distributed stores.
|
39
39
|
|
40
40
|
## Cache store
|
41
41
|
|
@@ -46,21 +46,30 @@ Provides a cache store for your Ruby web framework of choice.
|
|
46
46
|
config.gem "redis-store"
|
47
47
|
config.cache_store = :redis_store
|
48
48
|
|
49
|
+
### Rails 2.x (with Bundler)
|
50
|
+
|
51
|
+
# Gemfile
|
52
|
+
gem "redis-store"
|
53
|
+
|
54
|
+
# in your configuration
|
55
|
+
config.gem "redis-store"
|
56
|
+
config.cache_store = :redis_store, { ... optional configuration ... }
|
57
|
+
|
49
58
|
### Rails 3.x
|
50
59
|
|
51
60
|
# Gemfile
|
52
|
-
gem 'rails', '3.0.
|
61
|
+
gem 'rails', '3.0.3'
|
53
62
|
gem 'redis'
|
54
|
-
gem 'redis-store', '1.0.0.
|
63
|
+
gem 'redis-store', '1.0.0.beta4'
|
55
64
|
|
56
65
|
# config/environments/production.rb
|
57
|
-
config.cache_store = :redis_store
|
66
|
+
config.cache_store = :redis_store, { ... optional configuration ... }
|
58
67
|
|
59
68
|
For advanced configurations scenarios please visit [the wiki](http://wiki.github.com/jodosha/redis-store/rails).
|
60
69
|
|
61
70
|
### Merb
|
62
71
|
|
63
|
-
dependency "redis-store", "1.0.0.
|
72
|
+
dependency "redis-store", "1.0.0.beta4"
|
64
73
|
dependency("merb-cache", merb_gems_version) do
|
65
74
|
Merb::Cache.setup do
|
66
75
|
register(:redis, Merb::Cache::RedisStore, :servers => ["127.0.0.1:6379"])
|
@@ -92,15 +101,52 @@ Provides a Redis store for Rack::Session. See [http://rack.rubyforge.org/doc/Rac
|
|
92
101
|
|
93
102
|
### Rails 2.x
|
94
103
|
|
104
|
+
# config/environment.rb
|
95
105
|
config.gem "redis-store"
|
106
|
+
|
107
|
+
# then configure as following:
|
108
|
+
|
109
|
+
# config/environments/*.rb
|
110
|
+
config.cache_store = :redis_store
|
111
|
+
|
112
|
+
# or
|
113
|
+
|
114
|
+
# config/initializers/session_store.rb
|
115
|
+
ActionController::Base.session = {
|
116
|
+
:key => APPLICATION['session_key'],
|
117
|
+
:secret => APPLICATION['session_secret'],
|
118
|
+
:key_prefix => Rails.env
|
119
|
+
}
|
120
|
+
|
121
|
+
ActionController::Base.session_store = :redis_session_store
|
122
|
+
|
123
|
+
### Rails 2.x (with Bundler)
|
124
|
+
|
125
|
+
# Gemfile
|
126
|
+
gem "redis-store"
|
127
|
+
|
128
|
+
# then configure as following:
|
129
|
+
|
130
|
+
# config/environments/*.rb
|
131
|
+
config.cache_store = :redis_store
|
132
|
+
|
133
|
+
# or
|
134
|
+
|
135
|
+
# config/initializers/session_store.rb
|
136
|
+
ActionController::Base.session = {
|
137
|
+
:key => APPLICATION['session_key'],
|
138
|
+
:secret => APPLICATION['session_secret'],
|
139
|
+
:key_prefix => Rails.env
|
140
|
+
}
|
141
|
+
|
96
142
|
ActionController::Base.session_store = :redis_session_store
|
97
143
|
|
98
144
|
### Rails 3.x
|
99
145
|
|
100
146
|
# Gemfile
|
101
|
-
gem 'rails', '3.0.
|
147
|
+
gem 'rails', '3.0.3'
|
102
148
|
gem 'redis'
|
103
|
-
gem 'redis-store', '1.0.0.
|
149
|
+
gem 'redis-store', '1.0.0.beta4'
|
104
150
|
|
105
151
|
# config/initializers/session_store.rb
|
106
152
|
MyApp::Application.config.session_store :redis_session_store
|
@@ -109,7 +155,7 @@ For advanced configurations scenarios please visit [the wiki](http://wiki.github
|
|
109
155
|
|
110
156
|
### Merb
|
111
157
|
|
112
|
-
dependency "redis-store", "1.0.0.
|
158
|
+
dependency "redis-store", "1.0.0.beta4"
|
113
159
|
Merb::Config.use do |c|
|
114
160
|
c[:session_store] = "redis"
|
115
161
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.0.
|
1
|
+
1.0.0.beta4
|
@@ -7,12 +7,12 @@ module RedisStore
|
|
7
7
|
# the MemCacheStore code, simply dropping in Redis instead.
|
8
8
|
#
|
9
9
|
# Options:
|
10
|
-
# :key
|
11
|
-
# :secret
|
12
|
-
# :host
|
13
|
-
# :port
|
14
|
-
# :db
|
15
|
-
# :key_prefix
|
10
|
+
# :key => Same as with the other cookie stores, key name
|
11
|
+
# :secret => Encryption secret for the key
|
12
|
+
# :host => Redis host name, default is localhost
|
13
|
+
# :port => Redis port, default is 6379
|
14
|
+
# :db => Database number, defaults to 0. Useful to separate your session storage from other data
|
15
|
+
# :key_prefix => Prefix for keys used in Redis, e.g. myapp-. Useful to separate session storage keys visibly from others
|
16
16
|
# :expire_after => A number in seconds to set the timeout interval for the session. Will map directly to expiry in Redis
|
17
17
|
module Rails
|
18
18
|
def initialize(app, options = {})
|
@@ -21,12 +21,12 @@ module RedisStore
|
|
21
21
|
|
22
22
|
super
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
24
|
+
options = options.dup
|
25
|
+
servers = [ options.delete(:servers) ].flatten.compact
|
26
|
+
servers = [ "redis://localhost:6379/0" ] if servers.empty?
|
27
|
+
servers.map! do |server|
|
28
|
+
server = Redis::Factory.convert_to_redis_client_options(server)
|
29
|
+
server.merge(options)
|
30
30
|
end
|
31
31
|
|
32
32
|
@pool = Redis::Factory.create(*servers)
|
@@ -46,7 +46,7 @@ module RedisStore
|
|
46
46
|
def set_session(env, sid, session_data)
|
47
47
|
options = env['rack.session.options']
|
48
48
|
@pool.set(sid, session_data, options)
|
49
|
-
return true
|
49
|
+
return(::Redis::Store.rails3? ? sid : true)
|
50
50
|
rescue Errno::ECONNREFUSED
|
51
51
|
return false
|
52
52
|
end
|
@@ -3,6 +3,30 @@ require "redis-store"
|
|
3
3
|
module ::RedisStore
|
4
4
|
module Cache
|
5
5
|
module Rails2
|
6
|
+
# Instantiate the store.
|
7
|
+
#
|
8
|
+
# Example:
|
9
|
+
# RedisStore.new
|
10
|
+
# # => host: localhost, port: 6379, db: 0
|
11
|
+
#
|
12
|
+
# RedisStore.new "example.com"
|
13
|
+
# # => host: example.com, port: 6379, db: 0
|
14
|
+
#
|
15
|
+
# RedisStore.new "example.com:23682"
|
16
|
+
# # => host: example.com, port: 23682, db: 0
|
17
|
+
#
|
18
|
+
# RedisStore.new "example.com:23682/1"
|
19
|
+
# # => host: example.com, port: 23682, db: 1
|
20
|
+
#
|
21
|
+
# RedisStore.new "example.com:23682/1/theplaylist"
|
22
|
+
# # => host: example.com, port: 23682, db: 1, namespace: theplaylist
|
23
|
+
#
|
24
|
+
# RedisStore.new "localhost:6379/0", "localhost:6380/0"
|
25
|
+
# # => instantiate a cluster
|
26
|
+
def initialize(*addresses)
|
27
|
+
@data = ::Redis::Factory.create(addresses)
|
28
|
+
end
|
29
|
+
|
6
30
|
def write(key, value, options = nil)
|
7
31
|
super
|
8
32
|
method = options && options[:unless_exist] ? :setnx : :set
|
@@ -42,6 +66,31 @@ module ::RedisStore
|
|
42
66
|
end
|
43
67
|
|
44
68
|
module Rails3
|
69
|
+
# Instantiate the store.
|
70
|
+
#
|
71
|
+
# Example:
|
72
|
+
# RedisStore.new
|
73
|
+
# # => host: localhost, port: 6379, db: 0
|
74
|
+
#
|
75
|
+
# RedisStore.new "example.com"
|
76
|
+
# # => host: example.com, port: 6379, db: 0
|
77
|
+
#
|
78
|
+
# RedisStore.new "example.com:23682"
|
79
|
+
# # => host: example.com, port: 23682, db: 0
|
80
|
+
#
|
81
|
+
# RedisStore.new "example.com:23682/1"
|
82
|
+
# # => host: example.com, port: 23682, db: 1
|
83
|
+
#
|
84
|
+
# RedisStore.new "example.com:23682/1/theplaylist"
|
85
|
+
# # => host: example.com, port: 23682, db: 1, namespace: theplaylist
|
86
|
+
#
|
87
|
+
# RedisStore.new "localhost:6379/0", "localhost:6380/0"
|
88
|
+
# # => instantiate a cluster
|
89
|
+
def initialize(*addresses)
|
90
|
+
@data = ::Redis::Factory.create(addresses)
|
91
|
+
super(addresses.extract_options!)
|
92
|
+
end
|
93
|
+
|
45
94
|
# Delete objects for matched keys.
|
46
95
|
#
|
47
96
|
# Example:
|
@@ -98,31 +147,6 @@ module ActiveSupport
|
|
98
147
|
class RedisStore < Store
|
99
148
|
include ::RedisStore::Cache::Store
|
100
149
|
|
101
|
-
# Instantiate the store.
|
102
|
-
#
|
103
|
-
# Example:
|
104
|
-
# RedisStore.new
|
105
|
-
# # => host: localhost, port: 6379, db: 0
|
106
|
-
#
|
107
|
-
# RedisStore.new "example.com"
|
108
|
-
# # => host: example.com, port: 6379, db: 0
|
109
|
-
#
|
110
|
-
# RedisStore.new "example.com:23682"
|
111
|
-
# # => host: example.com, port: 23682, db: 0
|
112
|
-
#
|
113
|
-
# RedisStore.new "example.com:23682/1"
|
114
|
-
# # => host: example.com, port: 23682, db: 1
|
115
|
-
#
|
116
|
-
# RedisStore.new "example.com:23682/1/theplaylist"
|
117
|
-
# # => host: example.com, port: 23682, db: 1, namespace: theplaylist
|
118
|
-
#
|
119
|
-
# RedisStore.new "localhost:6379/0", "localhost:6380/0"
|
120
|
-
# # => instantiate a cluster
|
121
|
-
def initialize(*addresses)
|
122
|
-
@data = ::Redis::Factory.create(addresses)
|
123
|
-
super(addresses.extract_options!)
|
124
|
-
end
|
125
|
-
|
126
150
|
# Reads multiple keys from the cache using a single call to the
|
127
151
|
# servers for all keys. Options can be passed in the last argument.
|
128
152
|
#
|
@@ -15,7 +15,7 @@ module Rack
|
|
15
15
|
def self.resolve(uri)
|
16
16
|
db = uri.path.sub(/^\//, '')
|
17
17
|
db = "0" if db.empty?
|
18
|
-
server = { :host => uri.host, :port => uri.port || "6379", :db => db }
|
18
|
+
server = { :host => uri.host, :port => uri.port || "6379", :db => db, :password => uri.password }
|
19
19
|
new server
|
20
20
|
end
|
21
21
|
end
|
@@ -10,7 +10,7 @@ module Rack
|
|
10
10
|
def self.resolve(uri)
|
11
11
|
db = uri.path.sub(/^\//, '')
|
12
12
|
db = "0" if db.empty?
|
13
|
-
server = { :host => uri.host, :port => uri.port || "6379", :db => db }
|
13
|
+
server = { :host => uri.host, :port => uri.port || "6379", :db => db, :password => uri.password }
|
14
14
|
new server
|
15
15
|
end
|
16
16
|
end
|
data/lib/rack/session/redis.rb
CHANGED
@@ -68,7 +68,7 @@ module Rack
|
|
68
68
|
|
69
69
|
delete = old.keys - new.keys
|
70
70
|
warn "//@#{sid}: dropping #{delete*','}" if $DEBUG and not delete.empty?
|
71
|
-
delete.each{|k| cur.
|
71
|
+
delete.each{|k| cur.delete k }
|
72
72
|
|
73
73
|
update = new.keys.select{|k| new[k] != old[k] }
|
74
74
|
warn "//@#{sid}: updating #{update*','}" if $DEBUG and not update.empty?
|
data/lib/redis-store.rb
CHANGED
@@ -16,6 +16,8 @@ elsif defined?(Merb)
|
|
16
16
|
# HACK for cyclic dependency: redis-store is required before merb-cache
|
17
17
|
module Merb; module Cache; class AbstractStore; end end end
|
18
18
|
require "cache/merb/redis_store"
|
19
|
+
elsif defined?(ActiveSupport)
|
20
|
+
require "active_support/cache/redis_store"
|
19
21
|
end
|
20
22
|
|
21
23
|
# Rack::Session
|
@@ -27,8 +29,7 @@ if defined?(Rack::Session)
|
|
27
29
|
end
|
28
30
|
end
|
29
31
|
|
30
|
-
|
31
|
-
if ::Redis::Store.rails3?
|
32
|
+
if defined?(Rails)
|
32
33
|
require "action_controller/session/redis_session_store"
|
33
34
|
end
|
34
35
|
|
data/lib/redis/factory.rb
CHANGED
@@ -33,11 +33,11 @@ class Redis
|
|
33
33
|
end
|
34
34
|
|
35
35
|
options = {}
|
36
|
-
options[:host] = host || uri.host
|
37
|
-
options[:port] = port || uri.port
|
36
|
+
options[:host] = host || uri && uri.host
|
37
|
+
options[:port] = port || uri && uri.port
|
38
38
|
options[:db] = db.to_i if db
|
39
39
|
options[:namespace] = namespace if namespace
|
40
|
-
options[:password] = password || uri.password
|
40
|
+
options[:password] = password || uri && uri.password
|
41
41
|
options
|
42
42
|
end
|
43
43
|
end
|
data/lib/redis/store.rb
CHANGED
data/lib/redis/store/version.rb
CHANGED
data/redis-store.gemspec
CHANGED
@@ -1,90 +1,88 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{redis-store}
|
8
|
-
s.version = "1.0.0.
|
8
|
+
s.version = "1.0.0.beta4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Luca Guidi"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-12-15}
|
13
13
|
s.description = %q{Namespaced Rack::Session, Rack::Cache, I18n and cache Redis stores for Ruby web frameworks.}
|
14
14
|
s.email = %q{guidi.luca@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"README.md"
|
17
17
|
]
|
18
18
|
s.files = [
|
19
|
-
"
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
"tasks/redis.tasks.rb"
|
19
|
+
"CHANGELOG",
|
20
|
+
"Gemfile",
|
21
|
+
"Gemfile.lock",
|
22
|
+
"MIT-LICENSE",
|
23
|
+
"README.md",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"lib/action_controller/session/redis_session_store.rb",
|
27
|
+
"lib/active_support/cache/redis_store.rb",
|
28
|
+
"lib/cache/merb/redis_store.rb",
|
29
|
+
"lib/cache/sinatra/redis_store.rb",
|
30
|
+
"lib/i18n/backend/redis.rb",
|
31
|
+
"lib/rack/cache/redis_entitystore.rb",
|
32
|
+
"lib/rack/cache/redis_metastore.rb",
|
33
|
+
"lib/rack/session/merb.rb",
|
34
|
+
"lib/rack/session/redis.rb",
|
35
|
+
"lib/redis-store.rb",
|
36
|
+
"lib/redis/distributed_store.rb",
|
37
|
+
"lib/redis/factory.rb",
|
38
|
+
"lib/redis/store.rb",
|
39
|
+
"lib/redis/store/interface.rb",
|
40
|
+
"lib/redis/store/marshalling.rb",
|
41
|
+
"lib/redis/store/namespace.rb",
|
42
|
+
"lib/redis/store/ttl.rb",
|
43
|
+
"lib/redis/store/version.rb",
|
44
|
+
"redis-store.gemspec",
|
45
|
+
"spec/action_controller/session/redis_session_store_spec.rb",
|
46
|
+
"spec/active_support/cache/redis_store_spec.rb",
|
47
|
+
"spec/cache/merb/redis_store_spec.rb",
|
48
|
+
"spec/cache/sinatra/redis_store_spec.rb",
|
49
|
+
"spec/config/master.conf",
|
50
|
+
"spec/config/single.conf",
|
51
|
+
"spec/config/slave.conf",
|
52
|
+
"spec/i18n/backend/redis_spec.rb",
|
53
|
+
"spec/rack/cache/entitystore/pony.jpg",
|
54
|
+
"spec/rack/cache/entitystore/redis_spec.rb",
|
55
|
+
"spec/rack/cache/metastore/redis_spec.rb",
|
56
|
+
"spec/rack/session/redis_spec.rb",
|
57
|
+
"spec/redis/distributed_store_spec.rb",
|
58
|
+
"spec/redis/factory_spec.rb",
|
59
|
+
"spec/redis/store/interface_spec.rb",
|
60
|
+
"spec/redis/store/marshalling_spec.rb",
|
61
|
+
"spec/redis/store/namespace_spec.rb",
|
62
|
+
"spec/redis/store/version_spec.rb",
|
63
|
+
"spec/spec_helper.rb",
|
64
|
+
"tasks/redis.tasks.rb"
|
66
65
|
]
|
67
66
|
s.homepage = %q{http://github.com/jodosha/redis-store}
|
68
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
69
67
|
s.require_paths = ["lib"]
|
70
68
|
s.rubygems_version = %q{1.3.7}
|
71
69
|
s.summary = %q{Namespaced Rack::Session, Rack::Cache, I18n and cache Redis stores for Ruby web frameworks.}
|
72
70
|
s.test_files = [
|
73
71
|
"spec/action_controller/session/redis_session_store_spec.rb",
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
72
|
+
"spec/active_support/cache/redis_store_spec.rb",
|
73
|
+
"spec/cache/merb/redis_store_spec.rb",
|
74
|
+
"spec/cache/sinatra/redis_store_spec.rb",
|
75
|
+
"spec/i18n/backend/redis_spec.rb",
|
76
|
+
"spec/rack/cache/entitystore/redis_spec.rb",
|
77
|
+
"spec/rack/cache/metastore/redis_spec.rb",
|
78
|
+
"spec/rack/session/redis_spec.rb",
|
79
|
+
"spec/redis/distributed_store_spec.rb",
|
80
|
+
"spec/redis/factory_spec.rb",
|
81
|
+
"spec/redis/store/interface_spec.rb",
|
82
|
+
"spec/redis/store/marshalling_spec.rb",
|
83
|
+
"spec/redis/store/namespace_spec.rb",
|
84
|
+
"spec/redis/store/version_spec.rb",
|
85
|
+
"spec/spec_helper.rb"
|
88
86
|
]
|
89
87
|
|
90
88
|
if s.respond_to? :specification_version then
|
@@ -93,11 +91,38 @@ Gem::Specification.new do |s|
|
|
93
91
|
|
94
92
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
95
93
|
s.add_runtime_dependency(%q<redis>, [">= 2.0.0"])
|
94
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
95
|
+
s.add_development_dependency(%q<git>, [">= 0"])
|
96
|
+
s.add_development_dependency(%q<rack>, [">= 0"])
|
97
|
+
s.add_development_dependency(%q<rack-cache>, [">= 0"])
|
98
|
+
s.add_development_dependency(%q<merb>, ["= 1.1.0"])
|
99
|
+
s.add_development_dependency(%q<rspec>, ["= 1.3.0"])
|
100
|
+
s.add_development_dependency(%q<i18n>, [">= 0"])
|
101
|
+
s.add_development_dependency(%q<ruby-debug>, [">= 0"])
|
102
|
+
s.add_runtime_dependency(%q<redis>, [">= 2.0.0"])
|
96
103
|
else
|
97
104
|
s.add_dependency(%q<redis>, [">= 2.0.0"])
|
105
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
106
|
+
s.add_dependency(%q<git>, [">= 0"])
|
107
|
+
s.add_dependency(%q<rack>, [">= 0"])
|
108
|
+
s.add_dependency(%q<rack-cache>, [">= 0"])
|
109
|
+
s.add_dependency(%q<merb>, ["= 1.1.0"])
|
110
|
+
s.add_dependency(%q<rspec>, ["= 1.3.0"])
|
111
|
+
s.add_dependency(%q<i18n>, [">= 0"])
|
112
|
+
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
113
|
+
s.add_dependency(%q<redis>, [">= 2.0.0"])
|
98
114
|
end
|
99
115
|
else
|
100
116
|
s.add_dependency(%q<redis>, [">= 2.0.0"])
|
117
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
118
|
+
s.add_dependency(%q<git>, [">= 0"])
|
119
|
+
s.add_dependency(%q<rack>, [">= 0"])
|
120
|
+
s.add_dependency(%q<rack-cache>, [">= 0"])
|
121
|
+
s.add_dependency(%q<merb>, ["= 1.1.0"])
|
122
|
+
s.add_dependency(%q<rspec>, ["= 1.3.0"])
|
123
|
+
s.add_dependency(%q<i18n>, [">= 0"])
|
124
|
+
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
125
|
+
s.add_dependency(%q<redis>, [">= 2.0.0"])
|
101
126
|
end
|
102
127
|
end
|
103
128
|
|
@@ -25,7 +25,7 @@ describe RAILS_SESSION_STORE_CLASS do
|
|
25
25
|
|
26
26
|
it "should accept string connection params" do
|
27
27
|
redis = instantiate_store
|
28
|
-
redis.to_s.should == "Redis Client connected to
|
28
|
+
redis.to_s.should == "Redis Client connected to localhost:6379 against DB 0"
|
29
29
|
|
30
30
|
redis = instantiate_store :servers => "redis://localhost"
|
31
31
|
redis.to_s.should == "Redis Client connected to localhost:6379 against DB 0"
|
@@ -45,12 +45,17 @@ describe RAILS_SESSION_STORE_CLASS do
|
|
45
45
|
redis.to_s.should == "Redis Client connected to 192.168.0.1:6379 against DB 0"
|
46
46
|
|
47
47
|
redis = instantiate_store :servers => [{ :port => "6380" }]
|
48
|
-
redis.to_s.should == "Redis Client connected to
|
48
|
+
redis.to_s.should == "Redis Client connected to 127.0.0.1:6380 against DB 0"
|
49
49
|
|
50
50
|
redis = instantiate_store :servers => [{ :db => 13 }]
|
51
|
-
redis.to_s.should == "Redis Client connected to
|
51
|
+
redis.to_s.should == "Redis Client connected to 127.0.0.1:6379 against DB 13"
|
52
52
|
|
53
53
|
redis = instantiate_store :servers => [{ :key_prefix => "theplaylist" }]
|
54
|
+
redis.to_s.should == "Redis Client connected to 127.0.0.1:6379 against DB 0 with namespace theplaylist"
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should accept options when :servers key isn't passed" do
|
58
|
+
redis = RAILS_SESSION_STORE_CLASS.new(app, :key_prefix => "theplaylist").instance_variable_get(:@pool)
|
54
59
|
redis.to_s.should == "Redis Client connected to localhost:6379 against DB 0 with namespace theplaylist"
|
55
60
|
end
|
56
61
|
|
@@ -31,6 +31,10 @@ module Rack
|
|
31
31
|
|
32
32
|
cache = Rack::Cache::EntityStore::Redis.resolve(uri("redis://127.0.0.1/13")).cache
|
33
33
|
cache.id.should == "redis://127.0.0.1:6379/13"
|
34
|
+
|
35
|
+
cache = Rack::Cache::EntityStore::Redis.resolve(uri("redis://:secret@127.0.0.1")).cache
|
36
|
+
cache.id.should == "redis://127.0.0.1:6379/0"
|
37
|
+
cache.client.password.should == 'secret'
|
34
38
|
end
|
35
39
|
|
36
40
|
# Entity store shared examples ===========================================
|
@@ -31,6 +31,10 @@ module Rack
|
|
31
31
|
|
32
32
|
cache = Rack::Cache::MetaStore::Redis.resolve(uri("redis://127.0.0.1/13")).cache
|
33
33
|
cache.to_s.should == "Redis Client connected to 127.0.0.1:6379 against DB 13"
|
34
|
+
|
35
|
+
cache = Rack::Cache::MetaStore::Redis.resolve(uri("redis://:secret@127.0.0.1")).cache
|
36
|
+
cache.id.should == "redis://127.0.0.1:6379/0"
|
37
|
+
cache.client.password.should == 'secret'
|
34
38
|
end
|
35
39
|
|
36
40
|
# Low-level implementation methods ===========================================
|
data/spec/spec_helper.rb
CHANGED
@@ -19,7 +19,11 @@ begin
|
|
19
19
|
require "action_controller/session/abstract_store" # Rails 2.3.x
|
20
20
|
rescue LoadError
|
21
21
|
require "action_dispatch/middleware/session/abstract_store" # Rails 3.x
|
22
|
-
module Rails
|
22
|
+
module ::Rails
|
23
|
+
module VERSION
|
24
|
+
MAJOR = 3
|
25
|
+
end
|
26
|
+
end
|
23
27
|
end
|
24
28
|
require "active_support/cache/redis_store"
|
25
29
|
require "action_controller/session/redis_session_store"
|
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: -1848230056
|
5
5
|
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
version: 1.0.0.
|
10
|
+
- beta4
|
11
|
+
version: 1.0.0.beta4
|
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: 2010-
|
19
|
+
date: 2010-12-15 00:00:00 +01:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -35,6 +35,138 @@ dependencies:
|
|
35
35
|
version: 2.0.0
|
36
36
|
type: :runtime
|
37
37
|
version_requirements: *id001
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: jeweler
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
hash: 3
|
47
|
+
segments:
|
48
|
+
- 0
|
49
|
+
version: "0"
|
50
|
+
type: :development
|
51
|
+
version_requirements: *id002
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
name: git
|
54
|
+
prerelease: false
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 3
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
version: "0"
|
64
|
+
type: :development
|
65
|
+
version_requirements: *id003
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
name: rack
|
68
|
+
prerelease: false
|
69
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
hash: 3
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
version: "0"
|
78
|
+
type: :development
|
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
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: merb
|
96
|
+
prerelease: false
|
97
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - "="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
hash: 19
|
103
|
+
segments:
|
104
|
+
- 1
|
105
|
+
- 1
|
106
|
+
- 0
|
107
|
+
version: 1.1.0
|
108
|
+
type: :development
|
109
|
+
version_requirements: *id006
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rspec
|
112
|
+
prerelease: false
|
113
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
115
|
+
requirements:
|
116
|
+
- - "="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
hash: 27
|
119
|
+
segments:
|
120
|
+
- 1
|
121
|
+
- 3
|
122
|
+
- 0
|
123
|
+
version: 1.3.0
|
124
|
+
type: :development
|
125
|
+
version_requirements: *id007
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: i18n
|
128
|
+
prerelease: false
|
129
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
130
|
+
none: false
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
hash: 3
|
135
|
+
segments:
|
136
|
+
- 0
|
137
|
+
version: "0"
|
138
|
+
type: :development
|
139
|
+
version_requirements: *id008
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: ruby-debug
|
142
|
+
prerelease: false
|
143
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
144
|
+
none: false
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
hash: 3
|
149
|
+
segments:
|
150
|
+
- 0
|
151
|
+
version: "0"
|
152
|
+
type: :development
|
153
|
+
version_requirements: *id009
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
name: redis
|
156
|
+
prerelease: false
|
157
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
158
|
+
none: false
|
159
|
+
requirements:
|
160
|
+
- - ">="
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
hash: 15
|
163
|
+
segments:
|
164
|
+
- 2
|
165
|
+
- 0
|
166
|
+
- 0
|
167
|
+
version: 2.0.0
|
168
|
+
type: :runtime
|
169
|
+
version_requirements: *id010
|
38
170
|
description: Namespaced Rack::Session, Rack::Cache, I18n and cache Redis stores for Ruby web frameworks.
|
39
171
|
email: guidi.luca@gmail.com
|
40
172
|
executables: []
|
@@ -44,7 +176,6 @@ extensions: []
|
|
44
176
|
extra_rdoc_files:
|
45
177
|
- README.md
|
46
178
|
files:
|
47
|
-
- .gitignore
|
48
179
|
- CHANGELOG
|
49
180
|
- Gemfile
|
50
181
|
- Gemfile.lock
|
@@ -96,8 +227,8 @@ homepage: http://github.com/jodosha/redis-store
|
|
96
227
|
licenses: []
|
97
228
|
|
98
229
|
post_install_message:
|
99
|
-
rdoc_options:
|
100
|
-
|
230
|
+
rdoc_options: []
|
231
|
+
|
101
232
|
require_paths:
|
102
233
|
- lib
|
103
234
|
required_ruby_version: !ruby/object:Gem::Requirement
|