views:

36

answers:

3

I'm building a web site with Rails, which will do something in the background. I don't want to use DelayedJob, because it needs a database.

What I wan't to do is simple: get some data from another site, save the response in the memory, and keep it for 10 minutes.

Is there any tools can do this?

+1  A: 

Use resque http://github.com/defunkt/resque. It uses a redis backed data store rather than the database.

Shripad K
@Shripad, thank you. I'm using resque now, it's good
Freewind
A: 

You can use a rake task in background to do this. Run it as a cron job or a daemon to perform tasks in the background.

Suman Mukherjee
you can store the results in memcached or some flat file....whatever way you want. Memcached would be better since it has a time to expiry.
Suman Mukherjee
If you want to run the rake task from the app this might help http://railscasts.com/episodes/127-rake-in-background
Suman Mukherjee
@Suman, I tried Memcached, but found it need at least 48M, this is too expensive for my poor VPS(240M memory), and I decide to use Resque. Thanks for your information~
Freewind
+1  A: 

You might want also want to try whenever. It's basically a ruby script that writes the scheduled job to cron.

jpartogi
@jpartogi, thank you. Whenever seems very good, I will try it somewhere else
Freewind