0

I'm writing the cache for an iOS app right now. I'm wondering how often i should refresh my cache. to give a little background, it's a weight loss app. what i'm working on right now, specifically, is a list of recipes. I pull the list of recipes from the server and display it in a table view. Obviously, i was going to make the list refresh when you pull down on the view controller. My question is, should i have it refresh the list every x number of days? or should it refresh every time the app is reopened? the list isnt expected to change more than once every 1 - 2 weeks, if that often. the user can also add their own recipes, so it could potentially change more often than that. is there a specific industry standard or protocol to follow for how often the cache should be refreshed?

jscs
  • 63,694
  • 13
  • 151
  • 195
Katushai
  • 1,510
  • 2
  • 14
  • 27
  • 2
    Time to learn one of the more famous [aphorisms](http://stackoverflow.com/questions/1188587/cache-invalidationis-there-a-general-solution) in CS. – CodaFi May 19 '14 at 17:58
  • didnt see that. thats interesting. i see we have a cunnundrum. you want to have a piece of cake. cake is good. you love having cake. but if you eat the cake, you will no longer have it. and nobody else will share. – Katushai May 19 '14 at 18:07
  • when user open your app , save the current time in user default. and when again user opens the app , check if your store date more then a threshold (1-2 week any thing you choose here.), then refresh it from backend. – Pawan Rai May 19 '14 at 18:35

1 Answers1

1

Why don't you hook up your app with a Push Notification Service ? so incase there is a new recipe you could dispatch a push notification and when the user opens the app refresh your cache. That way you only refresh your cache when needed and also aids in better user experience. Here's a good tutorial on setting up a push notification service

NavinDev
  • 995
  • 1
  • 7
  • 8
  • good suggestion. +1 for suggesting http://www.raywenderlich.com/. they have some REALLY useful articles on iOS work – Katushai May 19 '14 at 20:40