Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify Redis cache store docs #32279

Merged
merged 1 commit into from
Mar 17, 2018
Merged

Clarify Redis cache store docs #32279

merged 1 commit into from
Mar 17, 2018

Conversation

swrobel
Copy link
Contributor

@swrobel swrobel commented Mar 17, 2018

This should be backported to 5-2-stable along with the other change made to these docs.

Summary

  1. Fix minor grammatical issues & expound on some potentially confusing sections
  2. Explain hiredis support
  3. Add basic configuration
  4. Update example production config to fix syntax errors:
# frozen_string_literal: true

begin
  require "bundler/inline"
rescue LoadError => e
  $stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
  raise e
end

gemfile(true) do
  source "https://rubygems.org"

  git_source(:github) { |repo| "https://github.com/#{repo}.git" }

  # Activate the gem you are reporting the issue against.
  gem "rails", "5.2.0.rc1"
end

require "minitest/autorun"

# Ensure backward compatibility with Minitest 4
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)

Rails.application.configure do |config|
  # http://edgeguides.rubyonrails.org/caching_with_rails.html#activesupport-cache-rediscachestore
  cache_servers = %w[ "redis://cache-01:6379/0", "redis://cache-02:6379/0",  ],
  config.cache_store = :redis_cache_store, url: cache_servers,

  connect_timeout:    30,  # Defaults to 20 seconds
  read_timeout:       0.2, # Defaults to 1 second
  write_timeout:      0.2, # Defaults to 1 second
  reconnect_attempts: 1,   # Defaults to 0

  error_handler: -> (method:, returning:, exception:) {
    # Report errors to Sentry as warnings
    Raven.capture_exception exception, level: 'warning",
      tags: { method: method, returning: returning }
  }
end
$ ruby -v
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin17]
$ ruby test.rb  
test.rb:26: syntax error, unexpected tLABEL
...tore = :redis_cache_store, url: cache_servers,
...                           ^~~~

@swrobel swrobel changed the title Update Redis cache store docs Clarify Redis cache store docs Mar 17, 2018
Copy link
Member

@jeremy jeremy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great edits. Thanks @swrobel!

@jeremy jeremy merged commit a6b82a3 into rails:master Mar 17, 2018
jeremy pushed a commit that referenced this pull request Mar 17, 2018
@jeremy jeremy added this to the 5.2.0 milestone Mar 17, 2018
@swrobel swrobel deleted the patch-4 branch March 17, 2018 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants