Displaying 20 results from an estimated 7000 matches similar to: "Help: Expiring fragment cache across multiple domains"
2006 Jun 19
0
Expiring fragment cache when multiple domains point to the same app?
Hi All,
We have four domains setup for The Couch: thecouch.org.nz,
thecouch.co.nz, www.thecouch.org.nz and www.thecouch.co.nz. They are
all handled by the same rails app. The means that fragment caching
creates four folders in our cache directory, named after each URL.
This introduces two problems:
1: We are caching 4 times as much stuff as necessary
2: Our cache sweepers are only sweeping one
2005 Mar 10
6
Expiring Cache Fragments and fcgi
First let me say that Rails caching is very very cool. The traffic
(and responsiveness) I''ve saved by added 10 lines of ruby code would
be enourmous, if I actually had traffic... ;)
Sweepers as observers are great, btw. Since every page of my side is
dynamic, once I did some DB optimization I''m caching the content of
the index page which was taking the bulk of the time to load
2006 May 21
0
expiring cache fragments using script/runner
I''ve just set up caching on my site and want to expire some of fragments on
an hourly basis.
I was going to use cron and script/runner to do this.
For other fragments that I am expiring, I am using expire_fragment inside a
sweeper class, something like:
class QuestionSweeper < ActionController::Caching::Sweeper
observe Question
def after_validation_on_update(question)
2005 Apr 25
1
Problems when using sweepers with postbacks
I''m using a cache sweeper class [1] to take care of some pretty complex
sweeping. However, there is a problem with the current implementation.
Namely, the sweeper gets called only when an action named in
cache_sweeper is called using GET. As many methods where sweeper would
be useful are using postback to send the form to the same action, this
causes the cache to get swept when
2006 Sep 12
2
Cache sweeping and render_component (my mistake or Rails bug?)
Hi
I''m working on a program which relies on heavy cache sweeper usage.
I''ve just bumped onto an odd problem. When using render_component
method in layouts or templates with cache sweeping turned on, Rails
throws an exception with the following message:
NoMethodError in TestController#index
You have a nil object when you didn''t expect it!
The error occured while
2009 Apr 18
0
A bug in sweeper.rb? [was: A frustrating and strange error when config.action_controller.perform_caching = true]
I fired up the debugger and watched the code happen tonight.
The problem occurs if the config.action_controller.perform_caching = true in
your environment. It''s not set to true in development but it is set to true
in production and staging.
The problem occurs not in my controllers but in sweeping.rb (part of rails).
Rails calls this code for every controller which was instantiated in
2006 Jan 03
5
Are cache sweepers used?
After drawing many virtual blank stares in the IRC channel and finding
zero results on the wiki for ''sweeper'' I''m left to wonder whether
these are actually officially supported, or are on their way toward
being deprecated. Is there a better way of expiring caches on model
saves and deletions?
Sincerely,
Tom Lieber
tom@alltom.com
http://AllTom.com/
2007 Oct 21
4
Making 'expire_fragment' available to a model?
I noticed a lot of repetition across different Sweeper models in my
app expiring the same fragments and so have been trying to move all
the expire_fragment calls into another model which the sweepers can
then use but it''s not working as I''d hoped..
I''ve created a CacheDestroyer model and want to be able to call
something to the effect of:
2006 Apr 08
2
trouble expiring cached pages
I''m having a bear of a time getting my cached pages to expire. Maybe
one of you guys can help me out. I''ll show my sweeper and then my log
to show that it "should" be working.
class PragmaticSweeper < ActionController::Caching::Sweeper
observe Comment
def after_save(comment)
expire_page(comment.post_id)
end
private
def expire_page(post_id)
2006 Jan 27
0
Cache Sweepers and runner scripts that act on models?
I created a script that I call by ''./script/runner -e production
UpdateItems.get_new_items()'', which basically calls the model Item:
Item.create(attributes...)
I''ve set up a cache sweeper which removes caches after each
create/destroy/update on Item, and it works fine when accessing
controllers via the web server, but apparently doesn''t work via runner.
2006 Mar 24
2
Expiring cached actions outside of ActionController
In the site I''m building, my models are *almost* never updated within
ActionController-- all new data comes in via command line scripts
manipulating ActiveRecord directly.
Can anyone offer any hints about expiring cached actions without Sweeper?
-Ross
2009 Jul 09
0
Cache expiration with format not working as expected
Hi all,
In my OrdersController, I have two actions completed and incomplete
that respond_to HTML and CSV.
Im also action caching these actions
..
caches_action :completed, :incomplete
...
def completed
@orders = Order.completed
respond_to do |format|
format.html
format.csv {render :layout => false}
end
end
def incomplete
@orders = Order.incomplete
respond_to do
2006 Jul 12
3
Ajax, the Back button, and Sweepers
I''m working on an app that''s basically forms and that makes fairly heavy use of Ajax. As a result of the Ajax usage, if the visitor uses the back button they get the page as it was originally loaded, not as they left it. I''ve looked at the Sweeper documentation and can not tell for sure that it''ll do what I want, which is to force an unconditional reload from
2007 Feb 14
4
cache sweeper not getting called
Hi,
I''ve started to implement page caches but I''ve hit a brick wall getting
a sweeper to clear the cache when needed. It seems that any models that
I tell it to observe aren''t being observed properly. If I add the
sweeper to a controller the initialize method runs, but no matter what I
do the after_save/after_update callbacks aren''t running. Also if I try
to
2008 Apr 01
1
"Undefined method merge" when using sweeper
Hi,
I''m trying to use sweepers for the first time and got a problem - I
get "undefined method `merge'' for "/signature/
f2d7c7c66450b169.html":String". The "/signature/f2d7c7c66450b169.html"
part of the error message is the cached page.
Here''s my sweeper:
class FooSweeper < ActionController::Caching::Sweeper
observe Foo
def
2006 Apr 07
0
Where are my action cache files?
Hi everyone,
So, I''m working with Rails 1.0 for now, and I''ve set up some caching:
<% cache(:action => ''list'', :part => ''departments'') do %>
# Etc...
Now, I haven''t set up any expiration sweepers or triggers yet, but I
thought there would be an HTML page somewhere I could delete and then
have the cache rebuilt. Is that
2006 Jul 04
0
removing stale active record sessions
I have an application that is used by only a small number of persons.
This app stores its sessions in the database. When the user logs out,
the session is removed, but of course, there is always the possibility
that the user will forget to logout, and the session will go stale.
In other webapps, I have used a sweeper ruby script that I run as a
cron job to periodically clean these out. But I
2008 Apr 11
0
expiring cache outside controller (e.g. in rake tasks)
Hello,
I need to expire cache outside controller, in my rake tasks. I want to
use standard methods expire_fragment,etc.. but I can''t manage to use
them outside controllers. I tried including
ActiveController::Caching::Actions but didn''t work.
Anyone has any solution? I''m losing my head how to do it... (besides
manually deleting files)
Thanks
Uros
2006 May 29
4
Time-based cache fragment expiration
Hello,
I''m trying to figure out how I could implement fragment caching that
expires every x amount of time. I thought of writing a runner script
that would expire the cache and set it as a cron job, but that
doesn''t really work because runner scripts act on models and not
controllers.
Does anybody have any ideas?
Regards,
-carl
2010 Sep 08
0
Re: Call expire_fragment from outside sweepers or controllers
xponrails wrote:
> Hi all.
>
> I need to expire cached fragments from outside sweepers or
> controllers: I have a rake task that calls a method inside a module in
> the /lib directory. This task will be called at a scheduled time by a
> crontab job.
>
> After method execution I would like to expire some cached fragments.
>
> I''ve just tried to import