Questions tagged [fragment-caching]
74 questions
0
votes
0 answers
Calling controller method from a helper module
Using Rails 3.2
I'm trying to call expire_fragment, the Rails view method, from a helper but getting an error:
undefined method `expire_fragment' for #<#:0x00000103b853b8>
I'm trying to conditionally clear the cache. This…

Mark Swardstrom
- 17,217
- 6
- 62
- 70
0
votes
1 answer
Rails Fragment Caching doesn't work
I was trying to add fragment caching to speed up website performance.
Now, I tested it in development mode, so I change this
#environments/developments.rb
config.action_controller.perform_caching = true
And in erb
<% @projects.each do |project| %>
…

rj487
- 4,476
- 6
- 47
- 88
0
votes
2 answers
rails4 after caching query still runs
I have a rails 4 app and trying to implement caching. I use the @profiles_sidebar.first cache key for checking if new user was created. I'm not sure if this is ok, since there still is a db query. Is this the preferred mechanism to check if caching…

Sean Magyar
- 2,360
- 1
- 25
- 57
0
votes
1 answer
Rails 4 Fragment Cache Entire Page. How to Expire Cache In Model
How do I expire the main-page fragment in a model?
In my HTML
<% cache 'main-page' do %>
# html here
<% end %>
In my Post Model
after_create :clear_cache
after_update :clear_cache
def clear_cache
…

Niles Turner
- 300
- 1
- 15
0
votes
1 answer
Varnish not processing ESI request when fetching the page containing esi tag from cache?
I am using ESI for not caching a fragment of page. I have written the following configuration in vcl file for not caching my fragment:
sub vcl_backend_response{
set beresp.do_esi = true;
if (bereq.url ~ "/fragment") {
set…

Abhishek Saini
- 11
- 1
0
votes
2 answers
Memcached and Rails Fragment Caching Issue
When I have 2 views that fragment cache the same query BUT display them differently, there is only one fragment and they both display it the same way. Is there any way around this? For example...
#views/posts/list
- cache(@posts) do
-…

Michael Waxman
- 1,815
- 3
- 18
- 32
0
votes
1 answer
Can Rails' Fragment Caching be used without reference to persistent objects?
The project I am working on is a console style application, and does not have access to any persistent objects at all. All our models are transient objects that extend Hashie::Mash and are populated on the fly via access to various API calls.
I'm…

Dave Sag
- 13,266
- 14
- 86
- 134
0
votes
1 answer
Rails fragment caching don't fetch latest
I have this kind of caching
<% cache [obj.id, obj.updated_at] do %>
<%= render obj %>
<% end %>
in _obj.html.erb I have
<% cache ["obj/#{obj.id}/logic", obj.updated_at] do %>
some logic
<% end %>
<% cache [obj.parent.id, obj.parent.updated_at] do…

Nick Ginanto
- 31,090
- 47
- 134
- 244
0
votes
1 answer
Rails: cache with substitutes?
I have a partial I am caching, but one part of it is dynamic:
- cache @product do
.product
#.....
.price = format_money(@product.money)
And would like to turn it into something like this:
- cache_subst @product, {price:…

hakunin
- 4,041
- 6
- 40
- 57
0
votes
1 answer
RubyOnRails: Fragment cache entry creation date
Is it possible to obtain a fragment cache entry creation date?
Details: I use fragment caching for attachment link rendering in Wiki pages in ChilliProject. Cache key is formed from attachment file name. If the attachment was reloaded, I need update…

ILYA
- 495
- 6
- 18
0
votes
1 answer
Rails: Cache Sweepers and Expiring Fragments
I have a form where an admin can create a new user, in this form there is a remote: true. When the user is successfully created the section on the page that displays all of the users is updated. This is not happening in Production since I have…

dennismonsewicz
- 25,132
- 33
- 116
- 189
0
votes
1 answer
With Rails fragment caching working, why are SELECT statements appearing in my logs inside of the cached fragment?
I've just got memcached setup on my website hosted on Heroku using memcachier and dalli. I have wrapped my homepage in a fragment cache block. In my logs, I can see that the fragment is being cached and read correctly, and I've already found that…

jhonsmc
- 23
- 8
0
votes
2 answers
Some fields get old values in fragment cache in Rails
I have a view to show the details of a resource that is saved in the database. Some of the details belong to the Resource model itself, and some details belongs to associated models.
In the view I use fragment caching for the details.
When the user…

Johan Hovda
- 855
- 2
- 10
- 23
0
votes
1 answer
Assets miss in Rails (also using fragment caching). No memcache
Using Rails 3.1.1 on Heroku, running with two web dynos.
I am NOT using memcache at the moment. I am using fragment caching successfully.
I am getting a lot of cache miss (and very, very few fresh) in my logs. It should be noted that facebox-2 (that…

Christoffer
- 2,271
- 3
- 26
- 57