redis-store 1.0.0.beta5 → 1.0.0.rc1

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.

Potentially problematic release.


This version of redis-store might be problematic. Click here for more details.

data/CHANGELOG CHANGED
@@ -1,3 +1,14 @@
1
+ *1.0.0 [rc1] (June 5, 2011)*
2
+
3
+ * Bump version v1.0.0.rc1
4
+ * Re-implement the delete_entry because it s needed by the ActiveSupport::Cache [Cyril Mougel]
5
+ * Change readme documentation for rack-cache to use single redis database with namespace support per Redis maintainers recommendation [Travis D. Warlick, Jr.]
6
+ * Rack-Cache entity and meta store base classes should use the Redis::Factory.convert_to_redis_client_options method for DRYness and for namespace support [Travis D. Warlick, Jr.]
7
+ * Modify #fetch for cache stores to return the yielded value instead of OK [Rune Botten]
8
+ * Minor revisions to Readme language and organization [Jeff Casimir]
9
+ * Re-implement the delete_entry because it s needed by the ActiveSupport::Cache implementation in Rails 3 [Cyril Mougel]
10
+ * Refactor delete_matched [Andrei Kulakov]
11
+
1
12
  *1.0.0 [beta5] (April 2, 2011)*
2
13
 
3
14
  * Bump version v1.0.0.beta5
data/README.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## Installation
4
4
 
5
+ ### Redis, Option 1: Homebrew
6
+
7
+ MacOS X users should use [Homebrew](https://github.com/mxcl/homebrew) to install Redis:
8
+
9
+ brew install redis
10
+
11
+ ### Redis, Option 2: From Source
12
+
5
13
  Download and install Redis from [http://code.google.com/p/redis/](http://code.google.com/p/redis/)
6
14
 
7
15
  wget http://redis.googlecode.com/files/redis-2.0.0.tar.gz
@@ -10,32 +18,37 @@ Download and install Redis from [http://code.google.com/p/redis/](http://code.go
10
18
  cd redis
11
19
  make
12
20
 
13
- Install the gem
21
+ ### Install the Gem
14
22
 
15
- sudo gem install redis-store
23
+ Assuming you're using RVM or on Windows, install the gem with:
24
+
25
+ gem install redis-store
16
26
 
17
27
  ## Options
18
- There are two ways to configure the Redis server options: by an URI string and by an hash.
19
- By default each store try to connect on `localhost` with the port `6379` and the db `0`.
28
+ You can specify the Redis configuration details using a URI or a hash. By default the gem will attempt to connect to `localhost` port `6379` and the db `0`.
29
+
30
+ ### Set by URI
20
31
 
21
- ### String
32
+ For example
22
33
 
23
34
  "redis://:secret@192.168.1.100:23682/13/theplaylist"
24
35
 
36
+ Made up of the following:
37
+
25
38
  host: 192.168.1.100
26
39
  port: 23682
27
40
  db: 13
28
41
  namespace: theplaylist
29
42
  password: secret
30
43
 
31
- If you want to specify the `namespace` optional, you have to pass the `db` param too.
32
- #### __Important__: for now (beta5) `namespace` is only supported for single, non-distributed stores.
44
+ If you want to specify the `namespace` option, you have to pass the `db` param too.
45
+ #### __Important__: for now (rc1) `namespace` is only supported for single, non-distributed stores.
33
46
 
34
- ### Hash
47
+ ### Set by Hash
35
48
 
36
49
  { :host => 192.168.1.100, :port => 23682, :db => 13, :namespace => "theplaylist", :password => "secret" }
37
50
 
38
- #### __Important__: for now (beta5) `namespace` is only supported for single, non-distributed stores.
51
+ #### __Important__: for now (rc1) `namespace` is only supported for single, non-distributed stores.
39
52
 
40
53
  ## Cache store
41
54
 
@@ -58,9 +71,8 @@ Provides a cache store for your Ruby web framework of choice.
58
71
  ### Rails 3.x
59
72
 
60
73
  # Gemfile
61
- gem 'rails', '3.0.3'
62
74
  gem 'redis'
63
- gem 'redis-store', '1.0.0.beta5'
75
+ gem 'redis-store', '1.0.0.rc1'
64
76
 
65
77
  # config/environments/production.rb
66
78
  config.cache_store = :redis_store, { ... optional configuration ... }
@@ -69,7 +81,7 @@ For advanced configurations scenarios please visit [the wiki](https://github.com
69
81
 
70
82
  ### Merb
71
83
 
72
- dependency "redis-store", "1.0.0.beta5"
84
+ dependency "redis-store", "1.0.0.rc1"
73
85
  dependency("merb-cache", merb_gems_version) do
74
86
  Merb::Cache.setup do
75
87
  register(:redis, Merb::Cache::RedisStore, :servers => ["127.0.0.1:6379"])
@@ -150,7 +162,7 @@ Provides a Redis store for Rack::Session. See [http://rack.rubyforge.org/doc/Rac
150
162
  # Gemfile
151
163
  gem 'rails', '3.0.3'
152
164
  gem 'redis'
153
- gem 'redis-store', '1.0.0.beta5'
165
+ gem 'redis-store', '1.0.0.rc1'
154
166
 
155
167
  # config/initializers/session_store.rb
156
168
  MyApp::Application.config.session_store :redis_session_store
@@ -159,7 +171,7 @@ For advanced configurations scenarios please visit [the wiki](https://github.com
159
171
 
160
172
  ### Merb
161
173
 
162
- dependency "redis-store", "1.0.0.beta5"
174
+ dependency "redis-store", "1.0.0.rc1"
163
175
  Merb::Config.use do |c|
164
176
  c[:session_store] = "redis"
165
177
  end
@@ -192,8 +204,8 @@ Provides a Redis store for HTTP caching. See [http://github.com/rtomayko/rack-ca
192
204
  require "redis-store"
193
205
  require "application"
194
206
  use Rack::Cache,
195
- :metastore => 'redis://localhost:6379/0',
196
- :entitystore => 'redis://localhost:6380/1'
207
+ :metastore => 'redis://localhost:6379/0/metastore',
208
+ :entitystore => 'redis://localhost:6380/0/entitystore'
197
209
  run Application.new
198
210
 
199
211
  ## I18n
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0.beta5
1
+ 1.0.0.rc1
@@ -54,7 +54,7 @@ module ::RedisStore
54
54
  # cache.del_matched "rab*"
55
55
  def delete_matched(matcher, options = nil)
56
56
  instrument(:delete_matched, matcher, options) do
57
- @data.keys(matcher).each { |key| @data.del key }
57
+ !(keys = @data.keys(matcher)).empty? && @data.del(*keys)
58
58
  end
59
59
  end
60
60
 
@@ -99,7 +99,11 @@ module ::RedisStore
99
99
  options = merged_options(options)
100
100
  instrument(:delete_matched, matcher.inspect) do
101
101
  matcher = key_matcher(matcher, options)
102
- @data.keys(matcher).each { |key| delete_entry(key, options) }
102
+ begin
103
+ !(keys = @data.keys(matcher)).empty? && @data.del(*keys)
104
+ rescue Errno::ECONNREFUSED => e
105
+ false
106
+ end
103
107
  end
104
108
  end
105
109
 
@@ -120,12 +124,18 @@ module ::RedisStore
120
124
  nil
121
125
  end
122
126
 
127
+ ##
128
+ # Implement the ActiveSupport::Cache#delete_entry
129
+ #
130
+ # It's really needed and use
131
+ #
123
132
  def delete_entry(key, options)
124
133
  @data.del key
125
134
  rescue Errno::ECONNREFUSED => e
126
135
  false
127
136
  end
128
137
 
138
+
129
139
  # Add the namespace defined in the options to a pattern designed to match keys.
130
140
  #
131
141
  # This implementation is __different__ than ActiveSupport:
@@ -45,9 +45,13 @@ module Merb
45
45
  end
46
46
 
47
47
  def fetch(key, parameters = {}, conditions = {}, &blk)
48
- read(key, parameters) || (write key, yield, parameters, conditions if block_given?)
48
+ (data = read(key, parameters)) || block_given? && begin
49
+ data = yield
50
+ write(key, data, parameters, conditions)
51
+ end
52
+ data || nil
49
53
  end
50
-
54
+
51
55
  def exists?(key, parameters = {})
52
56
  @data.exists normalize(key, parameters)
53
57
  end
@@ -111,7 +111,11 @@ module Sinatra
111
111
  end
112
112
 
113
113
  def fetch(key, options = {})
114
- (!options[:force] && data = read(key, options)) || (write key, yield, options if block_given?)
114
+ (!options[:force] && data = read(key, options)) || block_given? && begin
115
+ data = yield
116
+ write(key, data, options)
117
+ end
118
+ data || nil
115
119
  end
116
120
 
117
121
  # Clear all the data from the store.
@@ -13,10 +13,7 @@ module Rack
13
13
  end
14
14
 
15
15
  def self.resolve(uri)
16
- db = uri.path.sub(/^\//, '')
17
- db = "0" if db.empty?
18
- server = { :host => uri.host, :port => uri.port || "6379", :db => db, :password => uri.password }
19
- new server
16
+ new ::Redis::Factory.convert_to_redis_client_options(uri.to_s)
20
17
  end
21
18
  end
22
19
 
@@ -8,10 +8,7 @@ module Rack
8
8
  attr_reader :cache
9
9
 
10
10
  def self.resolve(uri)
11
- db = uri.path.sub(/^\//, '')
12
- db = "0" if db.empty?
13
- server = { :host => uri.host, :port => uri.port || "6379", :db => db, :password => uri.password }
14
- new server
11
+ new ::Redis::Factory.convert_to_redis_client_options(uri.to_s)
15
12
  end
16
13
  end
17
14
 
@@ -4,7 +4,7 @@ class Redis
4
4
  MAJOR = 1
5
5
  MINOR = 0
6
6
  TINY = 0
7
- BUILD = "beta5"
7
+ BUILD = "rc1"
8
8
 
9
9
  STRING = [MAJOR, MINOR, TINY, BUILD].join('.')
10
10
  end
data/redis-store.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{redis-store}
8
- s.version = "1.0.0.beta5"
8
+ s.version = "1.0.0.rc1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Luca Guidi"]
12
- s.date = %q{2011-04-02}
11
+ s.authors = [%q{Luca Guidi}]
12
+ s.date = %q{2011-06-05}
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 = [
@@ -65,8 +65,8 @@ Gem::Specification.new do |s|
65
65
  "tasks/redis.tasks.rb"
66
66
  ]
67
67
  s.homepage = %q{http://github.com/jodosha/redis-store}
68
- s.require_paths = ["lib"]
69
- s.rubygems_version = %q{1.3.7}
68
+ s.require_paths = [%q{lib}]
69
+ s.rubygems_version = %q{1.8.5}
70
70
  s.summary = %q{Namespaced Rack::Session, Rack::Cache, I18n and cache Redis stores for Ruby web frameworks.}
71
71
  s.test_files = [
72
72
  "spec/action_controller/session/redis_session_store_spec.rb",
@@ -88,7 +88,6 @@ Gem::Specification.new do |s|
88
88
  ]
89
89
 
90
90
  if s.respond_to? :specification_version then
91
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
92
91
  s.specification_version = 3
93
92
 
94
93
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
@@ -100,7 +99,6 @@ Gem::Specification.new do |s|
100
99
  s.add_development_dependency(%q<rspec>, ["= 1.3.0"])
101
100
  s.add_development_dependency(%q<i18n>, [">= 0"])
102
101
  s.add_development_dependency(%q<ruby-debug>, [">= 0"])
103
- s.add_runtime_dependency(%q<redis>, [">= 2.0.0"])
104
102
  else
105
103
  s.add_dependency(%q<redis>, ["~> 2.2.0"])
106
104
  s.add_dependency(%q<jeweler>, [">= 0"])
@@ -110,7 +108,6 @@ Gem::Specification.new do |s|
110
108
  s.add_dependency(%q<rspec>, ["= 1.3.0"])
111
109
  s.add_dependency(%q<i18n>, [">= 0"])
112
110
  s.add_dependency(%q<ruby-debug>, [">= 0"])
113
- s.add_dependency(%q<redis>, [">= 2.0.0"])
114
111
  end
115
112
  else
116
113
  s.add_dependency(%q<redis>, ["~> 2.2.0"])
@@ -121,7 +118,6 @@ Gem::Specification.new do |s|
121
118
  s.add_dependency(%q<rspec>, ["= 1.3.0"])
122
119
  s.add_dependency(%q<i18n>, [">= 0"])
123
120
  s.add_dependency(%q<ruby-debug>, [">= 0"])
124
- s.add_dependency(%q<redis>, [">= 2.0.0"])
125
121
  end
126
122
  end
127
123
 
@@ -96,7 +96,7 @@ module Merb
96
96
  with_store_management do |store|
97
97
  store.fetch("rabbit").should == @rabbit
98
98
  store.fetch("rub-a-dub").should be_nil
99
- store.fetch("rub-a-dub") { "Flora de Cana" }
99
+ store.fetch("rub-a-dub") { "Flora de Cana" }.should == "Flora de Cana"
100
100
  store.fetch("rub-a-dub").should === "Flora de Cana"
101
101
  end
102
102
  end
@@ -169,7 +169,7 @@ module Sinatra
169
169
  with_store_management do |store|
170
170
  store.fetch("rabbit").should == @rabbit
171
171
  store.fetch("rub-a-dub").should be_nil
172
- store.fetch("rub-a-dub") { "Flora de Cana" }
172
+ store.fetch("rub-a-dub") { "Flora de Cana" }.should == "Flora de Cana"
173
173
  store.fetch("rub-a-dub").should === "Flora de Cana"
174
174
  store.fetch("rabbit", :force => true).should be_nil # force cache miss
175
175
  store.fetch("rabbit", :force => true, :expires_in => 1.second) { @white_rabbit }
@@ -2,6 +2,6 @@ require 'spec_helper'
2
2
 
3
3
  describe Redis::Store::VERSION do
4
4
  it "should describe Redis::Store version" do
5
- Redis::Store::VERSION::STRING.should == "1.0.0.beta5"
5
+ Redis::Store::VERSION::STRING.should == "1.0.0.rc1"
6
6
  end
7
7
  end
data/tasks/redis.tasks.rb CHANGED
@@ -154,7 +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
+ when "2.2.4" then "2b886275e9756bb8619a"
158
158
  end
159
159
 
160
160
  arguments = commit.nil? ? "pull origin master" : "reset --hard #{commit}"
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-store
3
3
  version: !ruby/object:Gem::Version
4
- hash: -1848230055
5
- prerelease: true
4
+ hash: 15424055
5
+ prerelease: 6
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
9
  - 0
10
- - beta5
11
- version: 1.0.0.beta5
10
+ - rc
11
+ - 1
12
+ version: 1.0.0.rc1
12
13
  platform: ruby
13
14
  authors:
14
15
  - Luca Guidi
@@ -16,8 +17,7 @@ autorequire:
16
17
  bindir: bin
17
18
  cert_chain: []
18
19
 
19
- date: 2011-04-02 00:00:00 +02:00
20
- default_executable:
20
+ date: 2011-06-05 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: redis
@@ -137,22 +137,6 @@ dependencies:
137
137
  version: "0"
138
138
  type: :development
139
139
  version_requirements: *id008
140
- - !ruby/object:Gem::Dependency
141
- name: redis
142
- prerelease: false
143
- requirement: &id009 !ruby/object:Gem::Requirement
144
- none: false
145
- requirements:
146
- - - ">="
147
- - !ruby/object:Gem::Version
148
- hash: 15
149
- segments:
150
- - 2
151
- - 0
152
- - 0
153
- version: 2.0.0
154
- type: :runtime
155
- version_requirements: *id009
156
140
  description: Namespaced Rack::Session, Rack::Cache, I18n and cache Redis stores for Ruby web frameworks.
157
141
  email: guidi.luca@gmail.com
158
142
  executables: []
@@ -209,7 +193,6 @@ files:
209
193
  - spec/redis/store_spec.rb
210
194
  - spec/spec_helper.rb
211
195
  - tasks/redis.tasks.rb
212
- has_rdoc: true
213
196
  homepage: http://github.com/jodosha/redis-store
214
197
  licenses: []
215
198
 
@@ -241,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
241
224
  requirements: []
242
225
 
243
226
  rubyforge_project:
244
- rubygems_version: 1.3.7
227
+ rubygems_version: 1.8.5
245
228
  signing_key:
246
229
  specification_version: 3
247
230
  summary: Namespaced Rack::Session, Rack::Cache, I18n and cache Redis stores for Ruby web frameworks.