I've also noticed a strange cache error, but it seems to only affect
my site_index.
I have a twitter feed on my main page... If I log in, I can see my
newest status, but when I log out, it reverts back to the twitter
status which is a few hours old.

Processing BaseController#site_index (for xx.xx.xx.xx at 2009-03-24
15:20:58) [GET]
  Session ID:
BAh7BzoOcmV0dXJuX3RvIikvQW1hemluZ0NsZWFuUWxkL2ZyaWVuZHNoaXBz
L3BlbmRpbmciCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpG
bGFzaEhhc2h7AAY6CkB1c2VkewA=--a1099f3f27ab3fcb27b7439fe74896f6b4fc4348
  Parameters: {"action"=>"site_index", "controller"=>"base"}
Filter chain halted as
[#<ActionController::Caching::Actions::ActionCacheFilter:0xb6d4fee8
@options={:cache_path=>nil}>] rendered_or_redirected.
Filter chain halted as [#<ActionController::Filters::AroundFilter:
0xb6d4fd80 @identifier=nil, @kind=:filter, @options={:only=>
[:site_index, :footer_content], :if=>#<Proc:0xb700c5f0@/home/user/
company/vendor/plugins/community_engine/app/controllers/
base_controller.rb:10>},
@method=#<ActionController::Caching::Actions::ActionCacheFilter:
0xb6d4fee8 @options={:cache_path=>nil}>>] did_not_yield.
Completed in 0.00044 (2278 reqs/sec) | DB: 0.00000 (0%) | 200 OK
[http://www.company.com.au/]

On Mar 10, 5:59 am, Bruno Bornsztein <[email protected]>
wrote:
> Sure, you can set the log level in production to whatever you want. In
> production.rb:
>
> config.log_level = :debug (or :info, or whatever)
>
> On Sat, Mar 7, 2009 at 10:18 AM, Justin G <[email protected]> wrote:
>
> > Thanks Bruno.  I already have the following code in my environments/
> > production.rb:
>
> > # Use a different cache store in production
> > config.cache_store = :file_store, "#{RAILS_ROOT}/tmp/cache"
>
> > I'm still looking into this problem to see what I can figure out.
> > I've been going through my dev and production logs.  Is there any way
> > to enable additional logging for a production server?  I would really
> > like to track cache hits/misses/expirations on my production server,
> > but without the full stack trace shown in the development logs.
>
> > I'm creating another git branch to track this in so that I can
> > contribute any fixes upstream.  I don't have any experience with unit
> > testing and may need some guidance in this area before my changes
> > could be pulled upstream.
>
> > Justin
>
> > On Mar 4, 5:47 pm, Bruno Bornsztein <[email protected]>
> > wrote:
> > > I'll have to take a closer look at this when I get more time, but could
> > you
> > > try putting this in your environment.rb:
>
> > > ActionController::Base.cache_store = :file_store,
> > "#{RAILS_ROOT}/tmp/cache"
>
> > > See if that solves your problems.
> > > More broadly, though, the caching and sweeping in CE needs a little TLC,
> > and
> > > testing!
>
> > > Thanks,
> > > Bruno
>
> > > On Mon, Mar 2, 2009 at 10:32 PM, Justin G <[email protected]> wrote:
>
> > > > About a month ago I launched my community engine site into the wild.
> > > > At the time, I had some caching issues with the front page.  I read up
> > > > on how caching works in rails and looked at the code a bit, but
> > > > everything looked OK.  So I figured it was best to disable caching for
> > > > the site_index action and swore to revisit the issue at a later time.
>
> > > > I'm running my production site on mod_passenger so I also limited the
> > > > number of processes to 1.  I figured that if the cache was being
> > > > stored in memory, then different processes could be serving from
> > > > different caches.  Since the problem was hit or miss it seemed like
> > > > this could also be the issue.  (And with a small site running on a VPS
> > > > with limited memory I wasn't yet worried about scalability.)
>
> > > > Anyway, I recently noticed a problem with comments that weren't
> > > > updating.  I received an email that someone commented on my post, but
> > > > I could only see the comment if I was logged in.  I figured it was a
> > > > caching problem so I restarted the server and the problem went away.
> > > > Here are some things I found while investigating the issue, and an
> > > > issue I am still having.
>
> > > > Original Problem
>
> > > > I tracked part of the problem down to the fact that the comment
> > > > sweeper wasn't clearing all copies in the cache.  My development.log
> > > > file showed that the comment_sweeper was clearing /jtgeibel/posts/7-
> > > > testing (among other things), but it wasn't clearing /posts/show/7-
> > > > testing (the cache fragment that is actually being hit).  I looked at
> > > > the code and made the following change:
>
> > > > -       expire_action :controller => 'posts', :action => 'show', :id
> > > > => record.commentable , :user_id => record.commentable.user
> > > > +      expire_action :controller => 'posts', :action => 'show', :id =>
> > > > record.commentable
>
> > > > From what I can tell, rails is only clearing the cache for the more
> > > > specific route containing a user_id.  However, its the action posts/
> > > > show that is actually being cached.  With this fix, I now see the
> > > > fragment cache being cleared in the log, but I'm still having one very
> > > > strange problem.
>
> > > > New Problem
>
> > > > I can see in the development log that the cache is being cleared, but
> > > > the first time I view the page (after logging out) I actually get a
> > > > cache hit.  If I refresh the page again, I see the updated page.  Here
> > > > is a commented portion of what I am seeing in my log file.
>
> > > > $ cat ../../../log/development.log |grep fragment
>
> > > > # ensure cache is full before posting a comment
> > > > Cached fragment hit: views/dev.pittsburghgardenexperiment.org/posts/
> > > > show/7-testing<
> >http://dev.pittsburghgardenexperiment.org/posts/%0Ashow/7-testing>(0.1ms)
> > > > # commenting expires caches
> > > > Expired fragment: views/
> > dev.pittsburghgardenexperiment.org/application/
> > > > footer_content (0.1ms)
> > > > Expired fragment: views/
> > dev.pittsburghgardenexperiment.org/application/
> > > > footer_content (0.1ms)
> > > > Expired fragment: views/dev.pittsburghgardenexperiment.org/posts/show/
> > > > 7-testing<
> >http://dev.pittsburghgardenexperiment.org/posts/show/%0A7-testing>(0.1ms)
> > > > Expired fragment: views/dev.pittsburghgardenexperiment.org/index
> > > > (0.1ms)
> > > > Expired fragment: views/dev.pittsburghgardenexperiment.org/categories/
> > > > 4-Talk <http://dev.pittsburghgardenexperiment.org/categories/%0A4-Talk
> > >(0.1ms)
> > > > # logout and refresh and we get a cache hit
> > > > Cached fragment hit: views/dev.pittsburghgardenexperiment.org/posts/
> > > > show/7-testing<
> >http://dev.pittsburghgardenexperiment.org/posts/%0Ashow/7-testing>(0.1ms)
> > > > # refresh again and we get a hit, followed by a miss in the same
> > > > request.  The correct content is rendered.
> > > > Cached fragment hit: views/dev.pittsburghgardenexperiment.org/posts/
> > > > show/7-testing<
> >http://dev.pittsburghgardenexperiment.org/posts/%0Ashow/7-testing>(0.1ms)
> > > > Cached fragment miss: views/dev.pittsburghgardenexperiment.org/posts/
> > > > show/7-testing<
> >http://dev.pittsburghgardenexperiment.org/posts/%0Ashow/7-testing>(0.1ms)
>
> > > > Any thoughts on why I'm getting stale data on the first request?  Or
> > > > why the second request has a hit, followed by a miss?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CommunityEngine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/communityengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to