2017/05/19分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
- Change the cache key format for fragments to make it easier to debug key churn.
- Add support for recyclable cache keys with fragment caching. This uses the new versioned entries in the ActiveSupport::Cache stores and relies on the fact that Active Record has split #cache_key and #cache_version to support it.
Use recyclable cache keys (#29092)
fragments cachingのcache keyのフォーマットを、再利用可能なフォーマットに変更しています。
元々、デフォルトではcache keyにassocationのversion(timestamp)も含むようになっていました(e.g. projects/1-20170202145500
)。デフォルトだとassociationのversionはupdated_at
な為、レコードが更新される度に新しいkeyが生成されていました(当然その度に新しいcacheが生成されている)。
これを、cache keyとcache versionをわけて管理する事にして、cache keyを再利用可能にしています。具体的には、先のassocation versionはcache versionとして管理され、keyには含まれなくなります(cacheデータの中に含まれる)。
fragment cache keyのフォーマットは下記のように変更になります。
# before views/users/index:6e20170b482b34f88f6398ebcfa817c5/users/2-20170518223821145914 ^template path ^template tree digest ^class ^id ^version # after views/users/index:6e20170b482b34f88f6398ebcfa817c5/users/2 ^template path ^template tree digest ^class ^id
version情報はcacheの中に含まれるので、cache取得後、versionが違えばcacheが更新される、という形になっています。cache keyが無駄に生成されなくなるので、良さそう。
Merge pull request #29020 from stevenchanin/master
rails guideのActive Job Basics
の修正です。
Action Mailer
の項に、asynchronous queue をRake taskから使うと正しく処理が行わない旨説明を追加しています。asynchronous queueはスレッドで処理が行われるのですが、Rake taskはtaskが終了するとプロセスが終了してしまい、スレッドがqueueを処理する前になくなってしまう場合がある為。
各CHANGELOGのインデントの修正、メソッド名をバッククォートで囲むよう修正等を行っています。
Clarified description of formats [ci skip]
actionpack/lib/abstract_controller/base.rb
のdocの修正です。
AbstractController::Base#formats
のdocの言い回しを修正しています。
bundle mail 2.6.5 that includes fix for ::Fixnum warning
Gemfile.lock
の修正です。
mail
gemのバージョンを2.6.5に更新しています。
mathn has been gemified in ruby 2.5
Gemfile
の修正です。
Ruby 2.5の場合、mathn
gemをインストールするよう修正しています。 Ruby 2.5でmathn
はgem化されて、本体から外された為、
ERB::Util.url_encode no longer escapes ~ since ruby 2.5
actionview/test/template/url_helper_test.rb
の修正です。
ERB::Util.url_encode
メソッドがRuby 2.5から~
をエスケープしなくなった為、その変更に合わせてテストを修正しています。
因みにエスケープされなくなったのは、~
はUnreserved Charactersに含まれていなかった為との事です。もういっこ参考:RFC 3986 - Uniform Resource Identifier (URI): Generic Syntax
Add cache_key_with_version and use it in ActiveSupport::Cache.expand_cache_key
activerecord/lib/active_record/integration.rb
の修正です。
cache keyとversionを合わせて返すcache_key_with_version
メソッドを追加し、ActiveSupport::Cache.expand_cache_key
メソッドでそちらを使用するよう修正しています。
Merge pull request #29057 from koic/suppress_warning_assigned_but_unused_variable
actioncable/Rakefile
、
actionview/Rakefile
の修正です。
assets::verify
taskから使用していない変数を削除しています。
Merge pull request #29134 from joshaidan/document-action-name
AbstractController::Base#response_body
、#action_name
、#formats
メソッドにdocを追加し、API docに表示されるよう修正しています。