Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 如何在redis缓存rails中保存html_Ruby On Rails_Ruby_Caching_Redis - Fatal编程技术网

Ruby on rails 如何在redis缓存rails中保存html

Ruby on rails 如何在redis缓存rails中保存html,ruby-on-rails,ruby,caching,redis,Ruby On Rails,Ruby,Caching,Redis,我想在redis缓存rails中保存html def cache(cache_name) Rails.cache.fetch(cache_name, expires_in: 5.minutes){ yield } end 鉴于 <% cache("key") do %> <h1>Header</h1> <%end%> 标题 因为html在保存后不呈现,所以我的更新解决方案无法工作?否:(………您更改了帮助者的名称?它在我的机器上工作

我想在redis缓存rails中保存html

def cache(cache_name)
  Rails.cache.fetch(cache_name, expires_in: 5.minutes){ yield }
end
鉴于

<% cache("key") do %>
  <h1>Header</h1>
<%end%>

标题

因为html在保存后不呈现

,所以我的更新解决方案无法工作?否:(………您更改了帮助者的名称?它在我的机器上工作..您是否先清除了缓存?
Rails.cache.clear
?您是如何做到的?在控制台中键入
Rails.cache.clear
,然后按enter键