Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6328621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:29:32+00:00 2026-05-24T17:29:32+00:00

I’m a new Rails programmer working on a web app. As part of this

  • 0

I’m a new Rails programmer working on a web app. As part of this web app I am consuming a number of JSON pages generated by other sites’ web services. On a new request from the user, I may need to poll 3-5 web services.

To help with the speed of repeated common requests, I’m trying to do a local cache of the results of the services. For each service, if they have any results that match, I parse their format and insert the rows into my local table, along with the ‘pull’ id (which has the source I pulled from and the date).

My question is: this seems like a pretty common thing to do. I have it working fine with a single datasource but need to expand, so before I write a bunch of helper methods to help make my life easier, I’m curious if there is a better way to do it in the Rails framework using a gem or some other plugin…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T17:29:33+00:00Added an answer on May 24, 2026 at 5:29 pm

    This type of behavior is best done in the background.

    The more-conventional-but-still-awesome Ruby way of doing this would be to create a bunch of data sources in your DB and create a rake task that uses whatever tech you want in your app (use a gem like mechanize or nokogiri, write up a model, add some helpful Ruby classes in your app/lib folder, drop in a plugin or something from a vendor, whatever). Then you could invoke this rake task via a conventional cron job, or with something like clockwork (a badass ruby version of recurring-task manager, essentially).

    The more new-wave way of doing this would be to drop in something like DelayedJob to handle updating of a single data source. When you fetch data successfully for a given source set the expiration out as long as you care to, and when your application grabs that cached data next it can create another job in the queue for one of your workers to run that’ll update that data source. As soon as that job is complete, requests for that data can go to the fresh information. This prevents thing like having 5-minute-long rake tasks that wind up failing on an earlier source and never letting any data update, or having 6-hour polling intervals where one gets missed because the internet dropped for 12 seconds so your data is all stale by hours and hours.

    There are a lot of tools to use, and I know you were asking for specifics, but I hope this more general information on methodology/architecture might give you an idea of what you can do.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.