7

有没有办法在 Heroku 上缓存 Rails 4 应用程序的预编译资产?

我按照这篇博文和一些 heroku 文档中的说明进行操作,这大大加快了速度,但预编译资产仍然需要同样长的时间。

这是我的 gemfile 中的相关部分(还发现有必要启用 'user-env-compile' 实验室):

group :production, :staging do
  # for heroku, see https://devcenter.heroku.com/articles/rails-integration-gems
  gem 'rails_12factor'

  # https://devcenter.heroku.com/articles/rack-cache-memcached-rails31
  gem 'rack-cache'
  gem 'kgio'

  # faster heroku deploys (http://blog.alexmaccaw.com/faster-deploys)
  gem 'memcachier'
  gem 'dalli'
end

从我的 config/production.rb 和 config/staging.rb :

  # Neither of the below worked (tried separately)
  # config.assets.cache_store = :dalli_store
  config.assets.configure {|env| env.cache = ActiveSupport::Cache.lookup_store(:dalli_store) }

谢谢!

4

1 回答 1

0

看看 assets_sync gem。

于 2013-08-12T02:38:10.690 回答