Dalli を使用して Rails アプリでキャッシュ ストアを操作しようとしています。私はフラグメントキャッシングだけを行っており、開発構成を次のように設定しています。
#config.action_controller.perform_caching = true
config.cache_store = :dalli_store
すべてをキャッシュしていないように。私がキャッシングに興味を持っているフラグメントは次のようなものです:
<% cache("home_main", :expires_in => 1.minute) do %>
<div class='tabbed-content content-1'>
<%=render :partial => 'shared/launch-main', :locals => { :locations => @locations } %>
</div>
<% end %>
入って走ったら
ruby-1.9.2-p290 :019 > Rails.cache.stats
ruby-1.9.2-p290 :019 > y _
私は得る:
conn_yields: '0'
bytes: '17153'
curr_items: '1'
total_items: '5'
evictions: '0'
reclaimed: '0'
そのフラグメントキャッシュを取り戻す方法はありますか? それとも見る?私は試した:
Rails.cache.fetch('home_main')
しかし、それは機能していません。キャッシュ キーのリストを表示する方法はありますか?
どうも
編集#1
@ cpuguy83の場合-明らかに196msでDBに移動します:-(
Read fragment views/home_main (2.4ms)
Rendered index/homepage_launch_main.html.erb (2.8ms)
Completed 200 OK in 1623ms (Views: 11.5ms | ActiveRecord: 195.8ms)