redis-store 1.0.0.beta4 → 1.0.0.beta5
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 +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
    
        data/CHANGELOG
    CHANGED
    
    | @@ -1,3 +1,12 @@ | |
| 1 | 
            +
            *1.0.0 [beta5] (April 2, 2011)*
         | 
| 2 | 
            +
             | 
| 3 | 
            +
              * Bump version v1.0.0.beta5
         | 
| 4 | 
            +
              * Introducing Rails.cache.reconnect, useful for Unicorn environments. Closes #21
         | 
| 5 | 
            +
              * Namespaced i18n backend should strip namespace when lists available locales. Closes #62
         | 
| 6 | 
            +
              * how to configure Redis session store in Sinatra [Christian von Kleist]
         | 
| 7 | 
            +
              * gracefully handle Connection Refused errors, allows database fall-back on fetch [Michael Kintzer]
         | 
| 8 | 
            +
              * Sinatra's API must have changed, its registered not register. [Michael D'Auria]
         | 
| 9 | 
            +
             | 
| 1 10 | 
             
            *1.0.0 [beta4] (December 15, 2010)*
         | 
| 2 11 |  | 
| 3 12 | 
             
              * Bump version v1.0.0.beta4
         | 
    
        data/Gemfile
    CHANGED
    
    | @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            source :gemcutter
         | 
| 2 | 
            -
            gem "redis", " | 
| 2 | 
            +
            gem "redis", "~> 2.2.0"
         | 
| 3 3 |  | 
| 4 4 | 
             
            group :development do
         | 
| 5 5 | 
             
              gem "jeweler"
         | 
| @@ -7,7 +7,6 @@ group :development do | |
| 7 7 | 
             
            end
         | 
| 8 8 |  | 
| 9 9 | 
             
            group :development, :test, :rails3 do
         | 
| 10 | 
            -
              gem "rack"
         | 
| 11 10 | 
             
              gem "rack-cache"
         | 
| 12 11 | 
             
              gem "merb", "1.1.0"
         | 
| 13 12 | 
             
              gem "rspec", "1.3.0"
         | 
| @@ -22,12 +21,14 @@ end | |
| 22 21 |  | 
| 23 22 | 
             
            if ENV["REDIS_STORE_ENV"] == "rails3"
         | 
| 24 23 | 
             
              group :rails3 do
         | 
| 25 | 
            -
                gem " | 
| 26 | 
            -
                gem " | 
| 24 | 
            +
                gem "rack", "~> 1.2.1"
         | 
| 25 | 
            +
                gem "activesupport", "3.0.5"
         | 
| 26 | 
            +
                gem "actionpack", "3.0.5"
         | 
| 27 27 | 
             
              end
         | 
| 28 28 | 
             
            else
         | 
| 29 29 | 
             
              group :test do
         | 
| 30 | 
            -
                gem " | 
| 31 | 
            -
                gem " | 
| 30 | 
            +
                gem "rack", "~> 1.1.0"
         | 
| 31 | 
            +
                gem "activesupport", "2.3.11"
         | 
| 32 | 
            +
                gem "actionpack", "2.3.11"
         | 
| 32 33 | 
             
              end
         | 
| 33 34 | 
             
            end
         | 
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -8,10 +8,10 @@ GEM | |
| 8 8 | 
             
                  ZenTest (~> 4.3)
         | 
| 9 9 | 
             
                ZenTest (4.4.2)
         | 
| 10 10 | 
             
                abstract (1.0.0)
         | 
| 11 | 
            -
                actionpack (2.3. | 
| 12 | 
            -
                  activesupport (= 2.3. | 
| 11 | 
            +
                actionpack (2.3.11)
         | 
| 12 | 
            +
                  activesupport (= 2.3.11)
         | 
| 13 13 | 
             
                  rack (~> 1.1.0)
         | 
| 14 | 
            -
                activesupport (2.3. | 
| 14 | 
            +
                activesupport (2.3.11)
         | 
| 15 15 | 
             
                addressable (2.2.2)
         | 
| 16 16 | 
             
                bcrypt-ruby (2.1.2)
         | 
| 17 17 | 
             
                columnize (0.3.2)
         | 
| @@ -143,7 +143,7 @@ GEM | |
| 143 143 | 
             
                rake (0.8.7)
         | 
| 144 144 | 
             
                randexp (0.1.5)
         | 
| 145 145 | 
             
                  ParseTree
         | 
| 146 | 
            -
                redis (2. | 
| 146 | 
            +
                redis (2.2.0)
         | 
| 147 147 | 
             
                rspec (1.3.0)
         | 
| 148 148 | 
             
                ruby-debug (0.10.4)
         | 
| 149 149 | 
             
                  columnize (>= 0.1)
         | 
| @@ -167,14 +167,14 @@ PLATFORMS | |
| 167 167 | 
             
              ruby
         | 
| 168 168 |  | 
| 169 169 | 
             
            DEPENDENCIES
         | 
| 170 | 
            -
              actionpack (= 2.3. | 
| 171 | 
            -
              activesupport (= 2.3. | 
| 170 | 
            +
              actionpack (= 2.3.11)
         | 
| 171 | 
            +
              activesupport (= 2.3.11)
         | 
| 172 172 | 
             
              git
         | 
| 173 173 | 
             
              i18n
         | 
| 174 174 | 
             
              jeweler
         | 
| 175 175 | 
             
              merb (= 1.1.0)
         | 
| 176 | 
            -
              rack
         | 
| 176 | 
            +
              rack (~> 1.1.0)
         | 
| 177 177 | 
             
              rack-cache
         | 
| 178 | 
            -
              redis ( | 
| 178 | 
            +
              redis (~> 2.2.0)
         | 
| 179 179 | 
             
              rspec (= 1.3.0)
         | 
| 180 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 (beta5) `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 (beta5) `namespace` is only supported for single, non-distributed stores.
         | 
| 39 39 |  | 
| 40 40 | 
             
            ## Cache store
         | 
| 41 41 |  | 
| @@ -60,16 +60,16 @@ Provides a cache store for your Ruby web framework of choice. | |
| 60 60 | 
             
                # Gemfile
         | 
| 61 61 | 
             
                gem 'rails', '3.0.3'
         | 
| 62 62 | 
             
                gem 'redis'
         | 
| 63 | 
            -
                gem 'redis-store', '1.0.0. | 
| 63 | 
            +
                gem 'redis-store', '1.0.0.beta5'
         | 
| 64 64 |  | 
| 65 65 | 
             
                # config/environments/production.rb
         | 
| 66 66 | 
             
                config.cache_store = :redis_store, { ... optional configuration ... }
         | 
| 67 67 |  | 
| 68 | 
            -
            For advanced configurations scenarios please visit [the wiki]( | 
| 68 | 
            +
            For advanced configurations scenarios please visit [the wiki](https://github.com/jodosha/redis-store/wiki/Frameworks-Configuration).
         | 
| 69 69 |  | 
| 70 70 | 
             
            ### Merb
         | 
| 71 71 |  | 
| 72 | 
            -
                dependency "redis-store", "1.0.0. | 
| 72 | 
            +
                dependency "redis-store", "1.0.0.beta5"
         | 
| 73 73 | 
             
                dependency("merb-cache", merb_gems_version) do
         | 
| 74 74 | 
             
                  Merb::Cache.setup do
         | 
| 75 75 | 
             
                    register(:redis, Merb::Cache::RedisStore, :servers => ["127.0.0.1:6379"])
         | 
| @@ -83,10 +83,14 @@ For advanced configurations scenarios please visit [the wiki](http://wiki.github | |
| 83 83 | 
             
                class MyApp < Sinatra::Base
         | 
| 84 84 | 
             
                  register Sinatra::Cache
         | 
| 85 85 | 
             
                  get "/hi" do
         | 
| 86 | 
            -
                    cache.fetch("greet") { "Hello, World!" }
         | 
| 86 | 
            +
                    settings.cache.fetch("greet") { "Hello, World!" }
         | 
| 87 87 | 
             
                  end
         | 
| 88 88 | 
             
                end
         | 
| 89 89 |  | 
| 90 | 
            +
            Keep in mind that the above fetch will return "OK" on success, not the return of the block.
         | 
| 91 | 
            +
             | 
| 92 | 
            +
            For advanced configurations scenarios please visit [the wiki](https://github.com/jodosha/redis-store/wiki/Frameworks-Configuration).
         | 
| 93 | 
            +
             | 
| 90 94 | 
             
            ## Rack::Session
         | 
| 91 95 |  | 
| 92 96 | 
             
            Provides a Redis store for Rack::Session. See [http://rack.rubyforge.org/doc/Rack/Session.html](http://rack.rubyforge.org/doc/Rack/Session.html)
         | 
| @@ -146,16 +150,16 @@ Provides a Redis store for Rack::Session. See [http://rack.rubyforge.org/doc/Rac | |
| 146 150 | 
             
                # Gemfile
         | 
| 147 151 | 
             
                gem 'rails', '3.0.3'
         | 
| 148 152 | 
             
                gem 'redis'
         | 
| 149 | 
            -
                gem 'redis-store', '1.0.0. | 
| 153 | 
            +
                gem 'redis-store', '1.0.0.beta5'
         | 
| 150 154 |  | 
| 151 155 | 
             
                # config/initializers/session_store.rb
         | 
| 152 156 | 
             
                MyApp::Application.config.session_store :redis_session_store
         | 
| 153 157 |  | 
| 154 | 
            -
            For advanced configurations scenarios please visit [the wiki]( | 
| 158 | 
            +
            For advanced configurations scenarios please visit [the wiki](https://github.com/jodosha/redis-store/wiki/Frameworks-Configuration).
         | 
| 155 159 |  | 
| 156 160 | 
             
            ### Merb
         | 
| 157 161 |  | 
| 158 | 
            -
                dependency "redis-store", "1.0.0. | 
| 162 | 
            +
                dependency "redis-store", "1.0.0.beta5"
         | 
| 159 163 | 
             
                Merb::Config.use do |c|
         | 
| 160 164 | 
             
                  c[:session_store] = "redis"
         | 
| 161 165 | 
             
                end
         | 
| @@ -169,7 +173,7 @@ For advanced configurations scenarios please visit [the wiki](http://wiki.github | |
| 169 173 | 
             
                require "redis-store"
         | 
| 170 174 |  | 
| 171 175 | 
             
                class MyApp < Sinatra::Base
         | 
| 172 | 
            -
                  use Rack::Session::Redis
         | 
| 176 | 
            +
                  use Rack::Session::Redis, :redis_server => 'redis://127.0.0.1:6379/0' # Redis server on localhost port 6379, database 0
         | 
| 173 177 |  | 
| 174 178 | 
             
                  get "/" do
         | 
| 175 179 | 
             
                    session[:visited_at] = DateTime.now.to_s # This is stored in Redis
         | 
| @@ -177,6 +181,8 @@ For advanced configurations scenarios please visit [the wiki](http://wiki.github | |
| 177 181 | 
             
                  end
         | 
| 178 182 | 
             
                end
         | 
| 179 183 |  | 
| 184 | 
            +
            For advanced configurations scenarios please visit [the wiki](https://github.com/jodosha/redis-store/wiki/Frameworks-Configuration).
         | 
| 185 | 
            +
             | 
| 180 186 | 
             
            ## Rack::Cache
         | 
| 181 187 |  | 
| 182 188 | 
             
            Provides a Redis store for HTTP caching. See [http://github.com/rtomayko/rack-cache](http://github.com/rtomayko/rack-cache)
         | 
| @@ -198,6 +204,10 @@ Provides a Redis store for HTTP caching. See [http://github.com/rtomayko/rack-ca | |
| 198 204 |  | 
| 199 205 | 
             
            The backend accepts the uri string and hash options.
         | 
| 200 206 |  | 
| 207 | 
            +
            ## Unicorn
         | 
| 208 | 
            +
             | 
| 209 | 
            +
            Use `Rails.cache.reconnect` in your Unicorn hooks, in order to force the client reconnection.
         | 
| 210 | 
            +
             | 
| 201 211 | 
             
            ## Running specs
         | 
| 202 212 |  | 
| 203 213 | 
             
                gem install jeweler bundler
         | 
    
        data/Rakefile
    CHANGED
    
    | @@ -28,7 +28,7 @@ end | |
| 28 28 | 
             
            namespace :spec do
         | 
| 29 29 | 
             
              desc "Run all the examples by starting a detached Redis instance"
         | 
| 30 30 | 
             
              task :suite => :prepare do
         | 
| 31 | 
            -
                 | 
| 31 | 
            +
                invoke_with_redis_replication "spec:run"
         | 
| 32 32 | 
             
              end
         | 
| 33 33 |  | 
| 34 34 | 
             
              Spec::Rake::SpecTask.new(:run) do |t|
         | 
| @@ -39,7 +39,7 @@ end | |
| 39 39 |  | 
| 40 40 | 
             
            desc "Run all examples with RCov"
         | 
| 41 41 | 
             
            task :rcov => :prepare do
         | 
| 42 | 
            -
               | 
| 42 | 
            +
              invoke_with_redis_replication "rcov_run"
         | 
| 43 43 | 
             
            end
         | 
| 44 44 |  | 
| 45 45 | 
             
            Spec::Rake::SpecTask.new(:rcov_run) do |t|
         | 
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            1.0.0. | 
| 1 | 
            +
            1.0.0.beta5
         | 
| @@ -107,6 +107,8 @@ module ::RedisStore | |
| 107 107 | 
             
                    def write_entry(key, entry, options)
         | 
| 108 108 | 
             
                      method = options && options[:unless_exist] ? :setnx : :set
         | 
| 109 109 | 
             
                      @data.send method, key, entry, options
         | 
| 110 | 
            +
                    rescue Errno::ECONNREFUSED => e
         | 
| 111 | 
            +
                      false
         | 
| 110 112 | 
             
                    end
         | 
| 111 113 |  | 
| 112 114 | 
             
                    def read_entry(key, options)
         | 
| @@ -114,10 +116,14 @@ module ::RedisStore | |
| 114 116 | 
             
                      if entry
         | 
| 115 117 | 
             
                        entry.is_a?(ActiveSupport::Cache::Entry) ? entry : ActiveSupport::Cache::Entry.new(entry)
         | 
| 116 118 | 
             
                      end
         | 
| 119 | 
            +
                    rescue Errno::ECONNREFUSED => e
         | 
| 120 | 
            +
                      nil
         | 
| 117 121 | 
             
                    end
         | 
| 118 122 |  | 
| 119 123 | 
             
                    def delete_entry(key, options)
         | 
| 120 124 | 
             
                      @data.del key
         | 
| 125 | 
            +
                    rescue Errno::ECONNREFUSED => e
         | 
| 126 | 
            +
                      false
         | 
| 121 127 | 
             
                    end
         | 
| 122 128 |  | 
| 123 129 | 
             
                    # Add the namespace defined in the options to a pattern designed to match keys.
         | 
| @@ -221,6 +227,11 @@ module ActiveSupport | |
| 221 227 | 
             
                  def stats
         | 
| 222 228 | 
             
                    @data.info
         | 
| 223 229 | 
             
                  end
         | 
| 230 | 
            +
             | 
| 231 | 
            +
                  # Force client reconnection, useful Unicorn deployed apps.
         | 
| 232 | 
            +
                  def reconnect
         | 
| 233 | 
            +
                    @data.reconnect
         | 
| 234 | 
            +
                  end
         | 
| 224 235 | 
             
                end
         | 
| 225 236 | 
             
              end
         | 
| 226 237 | 
             
            end
         | 
    
        data/lib/redis/store.rb
    CHANGED
    
    
| @@ -26,7 +26,7 @@ class Redis | |
| 26 26 | 
             
                  end
         | 
| 27 27 |  | 
| 28 28 | 
             
                  def keys(pattern = "*")
         | 
| 29 | 
            -
                    namespace(pattern) { |pattern| super(pattern) }
         | 
| 29 | 
            +
                    namespace(pattern) { |pattern| super(pattern).map{|key| strip_namespace(key) } }
         | 
| 30 30 | 
             
                  end
         | 
| 31 31 |  | 
| 32 32 | 
             
                  def del(*keys)
         | 
| @@ -47,7 +47,15 @@ class Redis | |
| 47 47 | 
             
                    end
         | 
| 48 48 |  | 
| 49 49 | 
             
                    def interpolate(key)
         | 
| 50 | 
            -
                      key.match( | 
| 50 | 
            +
                      key.match(namespace_regexp) ? key : "#{@namespace}:#{key}"
         | 
| 51 | 
            +
                    end
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                    def strip_namespace(key)
         | 
| 54 | 
            +
                      key.gsub namespace_regexp, ""
         | 
| 55 | 
            +
                    end
         | 
| 56 | 
            +
             | 
| 57 | 
            +
                    def namespace_regexp
         | 
| 58 | 
            +
                      @namespace_regexp ||= %r{^#{@namespace}\:}
         | 
| 51 59 | 
             
                    end
         | 
| 52 60 | 
             
                end
         | 
| 53 61 | 
             
              end
         | 
    
        data/lib/redis/store/version.rb
    CHANGED
    
    
    
        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. | 
| 8 | 
            +
              s.version = "1.0.0.beta5"
         | 
| 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{ | 
| 12 | 
            +
              s.date = %q{2011-04-02}
         | 
| 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 = [
         | 
| @@ -46,9 +46,9 @@ Gem::Specification.new do |s| | |
| 46 46 | 
             
                "spec/active_support/cache/redis_store_spec.rb",
         | 
| 47 47 | 
             
                "spec/cache/merb/redis_store_spec.rb",
         | 
| 48 48 | 
             
                "spec/cache/sinatra/redis_store_spec.rb",
         | 
| 49 | 
            -
                "spec/config/ | 
| 50 | 
            -
                "spec/config/ | 
| 51 | 
            -
                "spec/config/ | 
| 49 | 
            +
                "spec/config/node-one.conf",
         | 
| 50 | 
            +
                "spec/config/node-two.conf",
         | 
| 51 | 
            +
                "spec/config/redis.conf",
         | 
| 52 52 | 
             
                "spec/i18n/backend/redis_spec.rb",
         | 
| 53 53 | 
             
                "spec/rack/cache/entitystore/pony.jpg",
         | 
| 54 54 | 
             
                "spec/rack/cache/entitystore/redis_spec.rb",
         | 
| @@ -60,6 +60,7 @@ Gem::Specification.new do |s| | |
| 60 60 | 
             
                "spec/redis/store/marshalling_spec.rb",
         | 
| 61 61 | 
             
                "spec/redis/store/namespace_spec.rb",
         | 
| 62 62 | 
             
                "spec/redis/store/version_spec.rb",
         | 
| 63 | 
            +
                "spec/redis/store_spec.rb",
         | 
| 63 64 | 
             
                "spec/spec_helper.rb",
         | 
| 64 65 | 
             
                "tasks/redis.tasks.rb"
         | 
| 65 66 | 
             
              ]
         | 
| @@ -82,6 +83,7 @@ Gem::Specification.new do |s| | |
| 82 83 | 
             
                "spec/redis/store/marshalling_spec.rb",
         | 
| 83 84 | 
             
                "spec/redis/store/namespace_spec.rb",
         | 
| 84 85 | 
             
                "spec/redis/store/version_spec.rb",
         | 
| 86 | 
            +
                "spec/redis/store_spec.rb",
         | 
| 85 87 | 
             
                "spec/spec_helper.rb"
         | 
| 86 88 | 
             
              ]
         | 
| 87 89 |  | 
| @@ -90,10 +92,9 @@ Gem::Specification.new do |s| | |
| 90 92 | 
             
                s.specification_version = 3
         | 
| 91 93 |  | 
| 92 94 | 
             
                if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
         | 
| 93 | 
            -
                  s.add_runtime_dependency(%q<redis>, [" | 
| 95 | 
            +
                  s.add_runtime_dependency(%q<redis>, ["~> 2.2.0"])
         | 
| 94 96 | 
             
                  s.add_development_dependency(%q<jeweler>, [">= 0"])
         | 
| 95 97 | 
             
                  s.add_development_dependency(%q<git>, [">= 0"])
         | 
| 96 | 
            -
                  s.add_development_dependency(%q<rack>, [">= 0"])
         | 
| 97 98 | 
             
                  s.add_development_dependency(%q<rack-cache>, [">= 0"])
         | 
| 98 99 | 
             
                  s.add_development_dependency(%q<merb>, ["= 1.1.0"])
         | 
| 99 100 | 
             
                  s.add_development_dependency(%q<rspec>, ["= 1.3.0"])
         | 
| @@ -101,10 +102,9 @@ Gem::Specification.new do |s| | |
| 101 102 | 
             
                  s.add_development_dependency(%q<ruby-debug>, [">= 0"])
         | 
| 102 103 | 
             
                  s.add_runtime_dependency(%q<redis>, [">= 2.0.0"])
         | 
| 103 104 | 
             
                else
         | 
| 104 | 
            -
                  s.add_dependency(%q<redis>, [" | 
| 105 | 
            +
                  s.add_dependency(%q<redis>, ["~> 2.2.0"])
         | 
| 105 106 | 
             
                  s.add_dependency(%q<jeweler>, [">= 0"])
         | 
| 106 107 | 
             
                  s.add_dependency(%q<git>, [">= 0"])
         | 
| 107 | 
            -
                  s.add_dependency(%q<rack>, [">= 0"])
         | 
| 108 108 | 
             
                  s.add_dependency(%q<rack-cache>, [">= 0"])
         | 
| 109 109 | 
             
                  s.add_dependency(%q<merb>, ["= 1.1.0"])
         | 
| 110 110 | 
             
                  s.add_dependency(%q<rspec>, ["= 1.3.0"])
         | 
| @@ -113,10 +113,9 @@ Gem::Specification.new do |s| | |
| 113 113 | 
             
                  s.add_dependency(%q<redis>, [">= 2.0.0"])
         | 
| 114 114 | 
             
                end
         | 
| 115 115 | 
             
              else
         | 
| 116 | 
            -
                s.add_dependency(%q<redis>, [" | 
| 116 | 
            +
                s.add_dependency(%q<redis>, ["~> 2.2.0"])
         | 
| 117 117 | 
             
                s.add_dependency(%q<jeweler>, [">= 0"])
         | 
| 118 118 | 
             
                s.add_dependency(%q<git>, [">= 0"])
         | 
| 119 | 
            -
                s.add_dependency(%q<rack>, [">= 0"])
         | 
| 120 119 | 
             
                s.add_dependency(%q<rack-cache>, [">= 0"])
         | 
| 121 120 | 
             
                s.add_dependency(%q<merb>, ["= 1.1.0"])
         | 
| 122 121 | 
             
                s.add_dependency(%q<rspec>, ["= 1.3.0"])
         | 
| @@ -39,6 +39,12 @@ module ActiveSupport | |
| 39 39 | 
             
                    store.should be_kind_of(Redis::DistributedStore)
         | 
| 40 40 | 
             
                  end
         | 
| 41 41 |  | 
| 42 | 
            +
                  it "should force reconnection" do
         | 
| 43 | 
            +
                    data = @store.instance_variable_get(:@data)
         | 
| 44 | 
            +
                    data.should_receive(:reconnect)
         | 
| 45 | 
            +
                    @store.reconnect
         | 
| 46 | 
            +
                  end
         | 
| 47 | 
            +
             | 
| 42 48 | 
             
                  it "should read the data" do
         | 
| 43 49 | 
             
                    with_store_management do |store|
         | 
| 44 50 | 
             
                      store.read("rabbit").should === @rabbit
         | 
| @@ -20,7 +20,8 @@ daemonize no | |
| 20 20 | 
             
            # default. You can specify a custom pid file location here.
         | 
| 21 21 | 
             
            pidfile /var/run/redis.pid
         | 
| 22 22 |  | 
| 23 | 
            -
            # Accept connections on the specified port, default is 6379
         | 
| 23 | 
            +
            # Accept connections on the specified port, default is 6379.
         | 
| 24 | 
            +
            # If port 0 is specified Redis will not listen on a TCP socket.
         | 
| 24 25 | 
             
            port 6380
         | 
| 25 26 |  | 
| 26 27 | 
             
            # If you want you can bind a single interface, if the bind option is not
         | 
| @@ -28,6 +29,12 @@ port 6380 | |
| 28 29 | 
             
            #
         | 
| 29 30 | 
             
            # bind 127.0.0.1
         | 
| 30 31 |  | 
| 32 | 
            +
            # Specify the path for the unix socket that will be used to listen for
         | 
| 33 | 
            +
            # incoming connections. There is no default, so Redis will not listen
         | 
| 34 | 
            +
            # on a unix socket when not specified.
         | 
| 35 | 
            +
            #
         | 
| 36 | 
            +
            # unixsocket /tmp/redis.sock
         | 
| 37 | 
            +
             | 
| 31 38 | 
             
            # Close the connection after a client is idle for N seconds (0 to disable)
         | 
| 32 39 | 
             
            timeout 300
         | 
| 33 40 |  | 
| @@ -37,13 +44,23 @@ timeout 300 | |
| 37 44 | 
             
            # verbose (many rarely useful info, but not a mess like the debug level)
         | 
| 38 45 | 
             
            # notice (moderately verbose, what you want in production probably)
         | 
| 39 46 | 
             
            # warning (only very important / critical messages are logged)
         | 
| 40 | 
            -
            loglevel  | 
| 47 | 
            +
            loglevel verbose
         | 
| 41 48 |  | 
| 42 49 | 
             
            # Specify the log file name. Also 'stdout' can be used to force
         | 
| 43 50 | 
             
            # Redis to log on the standard output. Note that if you use standard
         | 
| 44 51 | 
             
            # output for logging but daemonize, logs will be sent to /dev/null
         | 
| 45 52 | 
             
            logfile stdout
         | 
| 46 53 |  | 
| 54 | 
            +
            # To enable logging to the system logger, just set 'syslog-enabled' to yes,
         | 
| 55 | 
            +
            # and optionally update the other syslog parameters to suit your needs.
         | 
| 56 | 
            +
            # syslog-enabled no
         | 
| 57 | 
            +
             | 
| 58 | 
            +
            # Specify the syslog identity.
         | 
| 59 | 
            +
            # syslog-ident redis
         | 
| 60 | 
            +
             | 
| 61 | 
            +
            # Specify the syslog facility.  Must be USER or between LOCAL0-LOCAL7.
         | 
| 62 | 
            +
            # syslog-facility local0
         | 
| 63 | 
            +
             | 
| 47 64 | 
             
            # Set the number of databases. The default database is DB 0, you can select
         | 
| 48 65 | 
             
            # a different one on a per-connection basis using SELECT <dbid> where
         | 
| 49 66 | 
             
            # dbid is a number between 0 and 'databases'-1
         | 
| @@ -76,7 +93,7 @@ save 60 10000 | |
| 76 93 | 
             
            rdbcompression yes
         | 
| 77 94 |  | 
| 78 95 | 
             
            # The filename where to dump the DB
         | 
| 79 | 
            -
            dbfilename tmp/ | 
| 96 | 
            +
            dbfilename tmp/node-one-dump.rdb
         | 
| 80 97 |  | 
| 81 98 | 
             
            # The working directory.
         | 
| 82 99 | 
             
            #
         | 
| @@ -104,6 +121,19 @@ dir ./ | |
| 104 121 | 
             
            #
         | 
| 105 122 | 
             
            # masterauth <master-password>
         | 
| 106 123 |  | 
| 124 | 
            +
            # When a slave lost the connection with the master, or when the replication
         | 
| 125 | 
            +
            # is still in progress, the slave can act in two different ways:
         | 
| 126 | 
            +
            #
         | 
| 127 | 
            +
            # 1) if slave-serve-stale-data is set to 'yes' (the default) the slave will
         | 
| 128 | 
            +
            #    still reply to client requests, possibly with out of data data, or the
         | 
| 129 | 
            +
            #    data set may just be empty if this is the first synchronization.
         | 
| 130 | 
            +
            #
         | 
| 131 | 
            +
            # 2) if slave-serve-stale data is set to 'no' the slave will reply with
         | 
| 132 | 
            +
            #    an error "SYNC with master in progress" to all the kind of commands
         | 
| 133 | 
            +
            #    but to INFO and SLAVEOF.
         | 
| 134 | 
            +
            #
         | 
| 135 | 
            +
            slave-serve-stale-data yes
         | 
| 136 | 
            +
             | 
| 107 137 | 
             
            ################################## SECURITY ###################################
         | 
| 108 138 |  | 
| 109 139 | 
             
            # Require clients to issue AUTH <PASSWORD> before processing any other
         | 
| @@ -119,6 +149,22 @@ dir ./ | |
| 119 149 | 
             
            #
         | 
| 120 150 | 
             
            # requirepass foobared
         | 
| 121 151 |  | 
| 152 | 
            +
            # Command renaming.
         | 
| 153 | 
            +
            #
         | 
| 154 | 
            +
            # It is possilbe to change the name of dangerous commands in a shared
         | 
| 155 | 
            +
            # environment. For instance the CONFIG command may be renamed into something
         | 
| 156 | 
            +
            # of hard to guess so that it will be still available for internal-use
         | 
| 157 | 
            +
            # tools but not available for general clients.
         | 
| 158 | 
            +
            #
         | 
| 159 | 
            +
            # Example:
         | 
| 160 | 
            +
            #
         | 
| 161 | 
            +
            # rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52
         | 
| 162 | 
            +
            #
         | 
| 163 | 
            +
            # It is also possilbe to completely kill a command renaming it into
         | 
| 164 | 
            +
            # an empty string:
         | 
| 165 | 
            +
            #
         | 
| 166 | 
            +
            # rename-command CONFIG ""
         | 
| 167 | 
            +
             | 
| 122 168 | 
             
            ################################### LIMITS ####################################
         | 
| 123 169 |  | 
| 124 170 | 
             
            # Set the max number of connected clients at the same time. By default there
         | 
| @@ -148,6 +194,37 @@ dir ./ | |
| 148 194 | 
             
            #
         | 
| 149 195 | 
             
            # maxmemory <bytes>
         | 
| 150 196 |  | 
| 197 | 
            +
            # MAXMEMORY POLICY: how Redis will select what to remove when maxmemory
         | 
| 198 | 
            +
            # is reached? You can select among five behavior:
         | 
| 199 | 
            +
            # 
         | 
| 200 | 
            +
            # volatile-lru -> remove the key with an expire set using an LRU algorithm
         | 
| 201 | 
            +
            # allkeys-lru -> remove any key accordingly to the LRU algorithm
         | 
| 202 | 
            +
            # volatile-random -> remove a random key with an expire set
         | 
| 203 | 
            +
            # allkeys->random -> remove a random key, any key
         | 
| 204 | 
            +
            # volatile-ttl -> remove the key with the nearest expire time (minor TTL)
         | 
| 205 | 
            +
            # noeviction -> don't expire at all, just return an error on write operations
         | 
| 206 | 
            +
            # 
         | 
| 207 | 
            +
            # Note: with all the kind of policies, Redis will return an error on write
         | 
| 208 | 
            +
            #       operations, when there are not suitable keys for eviction.
         | 
| 209 | 
            +
            #
         | 
| 210 | 
            +
            #       At the date of writing this commands are: set setnx setex append
         | 
| 211 | 
            +
            #       incr decr rpush lpush rpushx lpushx linsert lset rpoplpush sadd
         | 
| 212 | 
            +
            #       sinter sinterstore sunion sunionstore sdiff sdiffstore zadd zincrby
         | 
| 213 | 
            +
            #       zunionstore zinterstore hset hsetnx hmset hincrby incrby decrby
         | 
| 214 | 
            +
            #       getset mset msetnx exec sort
         | 
| 215 | 
            +
            #
         | 
| 216 | 
            +
            # The default is:
         | 
| 217 | 
            +
            #
         | 
| 218 | 
            +
            # maxmemory-policy volatile-lru
         | 
| 219 | 
            +
             | 
| 220 | 
            +
            # LRU and minimal TTL algorithms are not precise algorithms but approximated
         | 
| 221 | 
            +
            # algorithms (in order to save memory), so you can select as well the sample
         | 
| 222 | 
            +
            # size to check. For instance for default Redis will check three keys and
         | 
| 223 | 
            +
            # pick the one that was used less recently, you can change the sample size
         | 
| 224 | 
            +
            # using the following configuration directive.
         | 
| 225 | 
            +
            #
         | 
| 226 | 
            +
            # maxmemory-samples 3
         | 
| 227 | 
            +
             | 
| 151 228 | 
             
            ############################## APPEND ONLY MODE ###############################
         | 
| 152 229 |  | 
| 153 230 | 
             
            # By default Redis asynchronously dumps the dataset on disk. If you can live
         | 
| @@ -195,6 +272,26 @@ appendonly no | |
| 195 272 | 
             
            appendfsync everysec
         | 
| 196 273 | 
             
            # appendfsync no
         | 
| 197 274 |  | 
| 275 | 
            +
            # When the AOF fsync policy is set to always or everysec, and a background
         | 
| 276 | 
            +
            # saving process (a background save or AOF log background rewriting) is
         | 
| 277 | 
            +
            # performing a lot of I/O against the disk, in some Linux configurations
         | 
| 278 | 
            +
            # Redis may block too long on the fsync() call. Note that there is no fix for
         | 
| 279 | 
            +
            # this currently, as even performing fsync in a different thread will block
         | 
| 280 | 
            +
            # our synchronous write(2) call.
         | 
| 281 | 
            +
            #
         | 
| 282 | 
            +
            # In order to mitigate this problem it's possible to use the following option
         | 
| 283 | 
            +
            # that will prevent fsync() from being called in the main process while a
         | 
| 284 | 
            +
            # BGSAVE or BGREWRITEAOF is in progress.
         | 
| 285 | 
            +
            #
         | 
| 286 | 
            +
            # This means that while another child is saving the durability of Redis is
         | 
| 287 | 
            +
            # the same as "appendfsync none", that in pratical terms means that it is
         | 
| 288 | 
            +
            # possible to lost up to 30 seconds of log in the worst scenario (with the
         | 
| 289 | 
            +
            # default Linux settings).
         | 
| 290 | 
            +
            # 
         | 
| 291 | 
            +
            # If you have latency problems turn this to "yes". Otherwise leave it as
         | 
| 292 | 
            +
            # "no" that is the safest pick from the point of view of durability.
         | 
| 293 | 
            +
            no-appendfsync-on-rewrite no
         | 
| 294 | 
            +
             | 
| 198 295 | 
             
            ################################ VIRTUAL MEMORY ###############################
         | 
| 199 296 |  | 
| 200 297 | 
             
            # Virtual Memory allows Redis to work with datasets bigger than the actual
         | 
| @@ -269,17 +366,25 @@ vm-max-threads 4 | |
| 269 366 |  | 
| 270 367 | 
             
            ############################### ADVANCED CONFIG ###############################
         | 
| 271 368 |  | 
| 272 | 
            -
            # Glue small output buffers together in order to send small replies in a
         | 
| 273 | 
            -
            # single TCP packet. Uses a bit more CPU but most of the times it is a win
         | 
| 274 | 
            -
            # in terms of number of queries per second. Use 'yes' if unsure.
         | 
| 275 | 
            -
            glueoutputbuf yes
         | 
| 276 | 
            -
             | 
| 277 369 | 
             
            # Hashes are encoded in a special way (much more memory efficient) when they
         | 
| 278 370 | 
             
            # have at max a given numer of elements, and the biggest element does not
         | 
| 279 371 | 
             
            # exceed a given threshold. You can configure this limits with the following
         | 
| 280 372 | 
             
            # configuration directives.
         | 
| 281 | 
            -
            hash-max-zipmap-entries  | 
| 282 | 
            -
            hash-max-zipmap-value  | 
| 373 | 
            +
            hash-max-zipmap-entries 512
         | 
| 374 | 
            +
            hash-max-zipmap-value 64
         | 
| 375 | 
            +
             | 
| 376 | 
            +
            # Similarly to hashes, small lists are also encoded in a special way in order
         | 
| 377 | 
            +
            # to save a lot of space. The special representation is only used when
         | 
| 378 | 
            +
            # you are under the following limits:
         | 
| 379 | 
            +
            list-max-ziplist-entries 512
         | 
| 380 | 
            +
            list-max-ziplist-value 64
         | 
| 381 | 
            +
             | 
| 382 | 
            +
            # Sets have a special encoding in just one case: when a set is composed
         | 
| 383 | 
            +
            # of just strings that happens to be integers in radix 10 in the range
         | 
| 384 | 
            +
            # of 64 bit signed integers.
         | 
| 385 | 
            +
            # The following configuration setting sets the limit in the size of the
         | 
| 386 | 
            +
            # set in order to use this special memory saving encoding.
         | 
| 387 | 
            +
            set-max-intset-entries 512
         | 
| 283 388 |  | 
| 284 389 | 
             
            # Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in
         | 
| 285 390 | 
             
            # order to help rehashing the main Redis hash table (the one mapping top-level
         |