I’m working on a locator/map project. You put in a zip code, and it searches the database for locations that are close to you. I’m using this code to find the geocodes. I’m also caching the geocodes.
What I do is, whenever I need to lookup a geocode for a zip code, first I look in the “cache” table I made. If I find it there, I return those results and I don’t have to harass Google. If I don’t find it there, I fetch it from Google and store the results in the table, so that I don’t have to look them up again.
The table has the zip code, the latitude, and the longitude.
In general it’s a good idea to store your geocodes in a table, whether they’re for zip codes only or for entire addresses. That information isn’t going to change, and it’s faster to pull from your own table than to fetch it from Google.