Displaying 20 results from an estimated 20000 matches similar to: "expiring cache outside controller (e.g. in rake tasks)"
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 Nov 04
1
expire_fragment outside of a controller
I am trying to figure out a way to call the
expire_fragment outside of a controller. I need to
expire some fragments on a hourly basis. I have a
Thread that every hour that will perform a task. The
expire_fragment is located in the module
ActionController::Caching::Fragments as an instance
method.
Do I need to mixin the model
ActionController::Caching::Fragments into my class?
Or is there
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
2007 Jul 14
0
newbi: Save console commands as script (e.g. rake task?)
Hello,
I am new to ruby but I am already with love with the console. What I am
looking for is a way, to write a parser that reads a text file and
creates database entries from it.
Something like:
for line in lines
p= Product.new
p.name=line
p.save
end
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because
2006 Jan 21
1
clearing/expiring the ''index'' action.
Hi all,
I''m having problems trying to expire the ''index'' action of a controller.
In short,
expire_action :action => ''index''
doesn''t work, but
expire_fragment (url_for :action =>
''index'').gsub(/\/index/,'''').split("://").last
works fine and deletes the cached page as expected.
I
2008 Sep 28
4
Cannot expire cache from background process?
Hello,
I am trying to expire fragments (or at least trigger their expiration)
from a daemon that''s running in the background.
The daemon is updating all kinds of important lists every few minutes
from the background.
So I have to find some way to DO or TRIGGER the fragment caching from
this daemon.
Unfortunately just using the normal commands like:
expire_fragment :controller =>
2008 Nov 06
8
anyone able to explain logic behind "rake spec" startup (e.g. db:test:prepare => abort_if_pending_migration => invoke environment => etc etc)
anyone able to explain logic behind "rake spec" startup? i.e. the
below steps & why things occur when they do
Macintosh-2:myequity greg$ rake spec --trace
(in /Users/greg/source/myequity)
** Invoke spec (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute
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:
2009 Dec 16
5
Caching comments: timestamps and subdomains
Hi,
I''m working on a website that has a very slow loading frontpage. I
wanted to start by caching certain elements that have high load. For
example, it loads the last 50 comments, along with the corresponding
usernames, avatars and more. So I cached that fragment and created a
sweeper that observes Comment and expires after every create or
destroy action.
However, I have two problems:
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
2008 May 07
0
Calling a controller method with a rake task - plugin errors
I have a rake task to call a controller method:
-------------------------------------
require ''action_controller''
require ''action_controller/integration''
namespace :backup do
desc "Starts automated backup procedure for all databases"
task "do_auto" do
app = ActionController::Integration::Session.new;
app.get
2007 Dec 16
0
Running default rake tasks?
I installed via piston and when in vendor/plugins/backgroundrb, I
attempt to run the default rake task:
(in /home/wallace/new_bdrb-wheels/vendor/plugins/backgroundrb)
rake aborted!
no such file to load -- spec/rake/spectask
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require''
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require''
2013 Feb 28
0
Rake tasks db:test:prepare cannot be executed in the same task of db:reset or db:migrate
Hey all,
I''m trying to create a task that prepare the environment to start
programming.
To do so, I created a task like this *task :setup_env => [''db:reset'',
''db:migrate'', ''db:test:prepare'']* and observed that after execute *
rake setup_env*, it never execute db:test:prepare properly. In order to get
the schema cloned to test db,
2009 Feb 03
3
Rcov - Specifying rake tasks
I am trying to get a customized rcov rake task working. What I have so
far looks like this:
desc "Rcov code coverage reports"
require ''rcov/rcovtask''
require ''spec/rake/spectask''
require ''cucumber/rake/task''
task :rcov => "rcov:all"
namespace :rcov do
Rcov::RcovTask.new(:all) do
task :rcov =>
2009 Nov 02
0
testing Rake tasks with FakeFS
Jake Benilov wrote:
> Hello Ben,
>
Hi Jake,
I hope you don''t mind but I am copying this response to the rspec-users
list in case any one else is able to shed more light on it.
> I have a bit of a newbie question regarding fakefs; I want to test Rake
> tasks using fakefs and rspec:
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> require
2010 Feb 25
0
Rails problems running rake and other tasks - undefined method `action_controller'
I suddenly have a major problem in all my Rails 3 apps:
$ rake db:migrate --trace
rake aborted!
Don''t know how to build task ''db:migrate''
/Users/kristianconsult/.rvm/gems/ruby-1.9.1-p378/gems/rake-0.8.7/lib/
rake.rb:1728:in `[]''
/Users/kristianconsult/.rvm/gems/ruby-1.9.1-p378/gems/rake-0.8.7/lib/
rake.rb:2050:in `invoke_task''
2009 Apr 24
1
Can rails environments be loaded only once and then execute rake tasks without loading it again and again?
Hi there guys,
I have a daemon that executes a rake task periodically in a loop in
the backend. And every time it runs the rake task, rails environment
is reloaded. Is there a way that the rails environment is loaded only
once before the loop and the following rake task will not load it
again and again?
Thank you in advance.
2008 Mar 18
0
rake tasks
Hi All,
New to merb, I was wondering if there are any similar rake tasks to that
of the rails rake stats?
Im using merb version 0.5.3
Tried the aok task and am getting the following:
eoghan-js-Computer:test_app eoghanj$ rake aok
(in /project/merb/test_app)
/usr/local/lib/ruby/gems/1.8/gems/merb-0.5.3/lib/merb/version.rb:45:
warning: already initialized constant RELEASE
rake rcov
(in
2006 Apr 12
2
Rake not finding lib/tasks folder?
Hi all,
I''m attempting to set up a new Rails app using Typo. I''ve downloaded
the Typo 2.6.0 edition which includes Rails 1.0 and it works fine. I''ve
set up version control with SVN and checked out a new working copy.
I''ve run Capistrano -A on the application and it''s set up my deploy.rb
and lib/tasks/capistrano.rake.
Rake doesn''t seem
2006 Mar 21
0
Automatic namespacing of custom Rake tasks
As you know you can create your own .rake files in lib/tasks and
Rails will automatically find them - as Rake 0.7 adds namespace
support and Rails is already taking advantage of these namespaces if
you are on Edge Rails I thought it would make a lot of sense if Rails
automatically namespaced your own custom rake files, so I raised a
ticket for this and I''ve now implemented it