5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-15 04:31:41 +00:00

usar redis como cache

This commit is contained in:
f 2019-07-29 15:51:09 -03:00
parent 5045ec8173
commit 45568bbb12
No known key found for this signature in database
GPG key ID: 2AE5A13E321F953D
3 changed files with 18 additions and 13 deletions

View file

@ -36,6 +36,7 @@ Metrics/MethodLength:
Metrics/BlockLength: Metrics/BlockLength:
Exclude: Exclude:
- 'config/environments/development.rb'
- 'config/environments/production.rb' - 'config/environments/production.rb'
- 'config/initializers/devise.rb' - 'config/initializers/devise.rb'
- 'db/schema.rb' - 'db/schema.rb'

View file

@ -1,11 +1,13 @@
# frozen_string_literal: true # frozen_string_literal: true
Rails.application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb. # Settings specified here will take precedence over those in
# config/application.rb.
# In the development environment your application's code is reloaded on # In the development environment your application's code is reloaded
# every request. This slows down response time but is perfect for development # on every request. This slows down response time but is perfect for
# since you don't have to restart the web server when you make code changes. # development since you don't have to restart the web server when you
# make code changes.
config.cache_classes = false config.cache_classes = false
# Do not eager load code on boot. # Do not eager load code on boot.
@ -18,7 +20,7 @@ Rails.application.configure do
if Rails.root.join('tmp/caching-dev.txt').exist? if Rails.root.join('tmp/caching-dev.txt').exist?
config.action_controller.perform_caching = true config.action_controller.perform_caching = true
config.cache_store = :memory_store config.cache_store = :redis_cache_store
config.public_file_server.headers = { config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}" 'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}"
} }
@ -39,8 +41,8 @@ Rails.application.configure do
# Raise an error on page load if there are pending migrations. # Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets. # Debug mode disables concatenation and preprocessing of assets. This
# This option may cause significant delays in view rendering with a large # option may cause significant delays in view rendering with a large
# number of complex assets. # number of complex assets.
config.assets.debug = true config.assets.debug = true
@ -50,8 +52,9 @@ Rails.application.configure do
# Raises error for missing translations # Raises error for missing translations
# config.action_view.raise_on_missing_translations = true # config.action_view.raise_on_missing_translations = true
# Use an evented file watcher to asynchronously detect changes in source code, # Use an evented file watcher to asynchronously detect changes in
# routes, locales, etc. This feature depends on the listen gem. # source code, routes, locales, etc. This feature depends on the
# listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker config.file_watcher = ActiveSupport::EventedFileUpdateChecker
CarrierWave.configure do |config| CarrierWave.configure do |config|
@ -63,5 +66,6 @@ Rails.application.configure do
config.action_mailer.perform_caching = false config.action_mailer.perform_caching = false
config.action_mailer.delivery_method = :letter_opener config.action_mailer.delivery_method = :letter_opener
config.action_mailer.perform_deliveries = true config.action_mailer.perform_deliveries = true
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } config.action_mailer.default_url_options = { host: 'localhost',
port: 3000 }
end end

View file

@ -56,12 +56,12 @@ Rails.application.configure do
config.log_tags = [:request_id] config.log_tags = [:request_id]
# Use a different cache store in production. # Use a different cache store in production.
# config.cache_store = :mem_cache_store config.cache_store = :redis_cache_store
# Use a real queuing backend for Active Job (and separate queues per # Use a real queuing backend for Active Job (and separate queues per
# environment) # environment)
# config.active_job.queue_adapter = :resque config.active_job.queue_adapter = :sidekiq
# config.active_job.queue_name_prefix = "sutty_#{Rails.env}" config.active_job.queue_name_prefix = "sutty_#{Rails.env}"
config.action_mailer.perform_caching = false config.action_mailer.perform_caching = false
# Ignore bad email addresses and do not raise email delivery errors. # Ignore bad email addresses and do not raise email delivery errors.