Well I would actually write your shell and then create whatever data
fetching/caching done in your model.
In your shell just do $uses = array('YourModel');.
I imagine you have some sort of function in your model that grabs data and
such, and then caches it.
So in your shell you can do just a call to a function in your model, and
all the data fetching, storing and caching is all done in your model.
I'm not sure if you will run into any errors but if you do it will probably
be something that it can't find Cache but you can just toss an App::uses up
above your model and it should solve the problem.
On Friday, September 7, 2012 2:51:19 PM UTC-7, Salines wrote:
>
> OK, I need clarification!
>
> Normally in my controller or action, I use cache to save the query.
>
> as described here
>
>
> http://book.cakephp.org/2.0/en/core-libraries/caching.html#using-cache-store-to-common-query-results
>
> This works nicely when the user visits the page, which takes data from its
> own database (MySQL). But not when the data come from external sources.
>
> To solve this problem, I want to run tasks in the background, which will
> allow us to save queries to be served to visitors when they come to the
> site.
>
> What interests me now, how to call these functions in the background.
>
> How to save queries from the shell?
>
> Thanks
>
--
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.