Caching REST with sfFunctionCache

by Dave Dash 07Apr07

[tags]geocoding, caching, REST, symfony, Cache_Lite, php, cache, sfFunctionCache[/tags]

For reviewsby.us we do a lot of geocoding. To facilitate we use Yahoo! Geocoding API. This helps us normalize data, obtain latitude and longitude, interpret location specific searches.

These REST queries happen a lot and will continue to happen, but this data that Yahoo! provides is fairly static. We're basically querying a database of sorts. So it makes sense that we should cache this data.

We'll demonstrate how to cache these queries using symfony's sfFunctionCache class.

I wrote a wrapper (I'll release it as a plugin if requested) for the Geocoding API, the bulk of the work (the REST call) occurs in a function called doQueryGIS:

The call to this function is always wrapped with queryGIS:

This wrapper creates a sfFunctionCache objet and calls the function and caches it for subsequent queries.

What this means is once Yahoo! teaches reviewsby.us that India is located at (25.42°, 77.830002°) and that the precision is 'country' we remember it in the future.

These features will be incorporated into future versions of reviewsby.us.


Where am I?

This is a single entry in the weblog.

"Caching REST with sfFunctionCache" is filed under programming, reviewsby.us and symfony. It was published in April 2007.

April 2007
M T W T F S S
« Mar   May »
 1
2345678
9101112131415
16171819202122
23242526272829
30  

need more help

If you found our tutorials and articles to be useful, but are still looking for more hands on help, consider hiring us. Find out more about how Spindrop can help you.

 

5 Responses to “Caching REST with sfFunctionCache”


  1. 1 Kay Posted April 11th, 2007 - 10:32 pm

    Hi. Could you please release your geocoding wrapper as a plugin?

  2. 2 Dave Dash Posted April 12th, 2007 - 4:52 pm

    Kay,

    I’ll work on that sometime this week. It’ll be very alpha.

  3. 3 Dave Dash Posted May 10th, 2007 - 11:11 am

    Here is a zip of the class file, didn’t have time to pluginify it.

Who's linking?

  1. 1 PHPDeveloper.org Trackback on Apr 9th, 2007
    "Spindrop.us: Caching REST with sfFunctionCache... ... "
  2. 2 developercast.com » Spindrop.us: Caching REST with sfFunctionCache Pingback on Apr 9th, 2007
    "[...] the SpinDrop blog, there’s a new article from Dave Dash highlighting one of the features of the symfony framework ... "

Further Help

If you require more hands on assistance, we do offer affordable hands on support.

Leave a Reply


Comment guidelines: No spamming, no profanity, and no flaming. Inappropriate comments will be deleted outright.