Hi,
I'm using fsockopen() to call a web service. The service simply looks up a surfer's IP address and returns their city with whatever accuracy. We get charged per query...so if a surfer refreshes the page 100 times, we get charged 100 times.
Don't ask me why we're not using another solution not involving a web service, I didn't make that decision
Anyway, I need to prevent that from happening but still allow the surfer to refresh the page 100 times. So what I want to do is cache the surfer's IP address and city after the lookup so that we only ever get charged once per IP within a given day. I was thinking of simply calling the webservice, storing the IP and city name in a mysql database, then every time a surfer visits the page, checking to see if we have the IP stored to begin with. If not, call the web service, otherwise, retrieve it from the db.
Is there a more elegant solution than this? We'll be doing about 9-10,000 lookups per day, and I'm not sure if there's a way to cache the responses with less performance hit, like not by using mysql?
Thanks.