views:

11

answers:

1

Hi, I've got a lot of POIs (compare MKAnnotation Protocol) in a backend on a webserver. I don't want to have a complete dump of all those in an iPhone database since normally you only need the POIs around your area. So my idea was a webservice which gets the actual shown region as paramters and gives back all relevant POIs. So far so good. BUT also totally crap. Using your finger to swipe left-right-left-right would result in a zillion webrequests. Using a two second delay (do the request after 2 seconds) would result in a bad performance (who wants to wait for such a long time?). So, "caching" is the word of the day. Does anybody now, if there are allready best practise or even pattern for this case? Otherwise here are my two ideas: 1. split the world-map into tiles (perhaps 1 km²). It is possible to identify those tiles by an id. So it would be possible to save in a local database if this tile is allready downloaded (so the POIs would be in the local POI-Database) or not. After a week or so, the entry for this tile would be deleted automatically to refresh the cache. 2. All POIs are cached. If a new region is shown, after two seconds, a request ist sent to the Webservice

What do you think about it? Is there a Datastructure which makes it possible to easily save areas which are not a square (but a set union of squares)? I would love to hear ideas to this topic, darth

A: 

You could consider only sending a request after the touchesEnded-event. This is how many applications's tableViewCells are working. (for example Twitter loads the avatar after you released your finger from the screen.)

Tim van Elsloo