有没有办法在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
Run Code Online (Sandbox Code Playgroud)
从我的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) }
Run Code Online (Sandbox Code Playgroud)
谢谢!