开发者

How best to cache images that don't change in every session

HI,

For how long data can be saved in Cache folder. I want to cach开发者_StackOverflow中文版e lot of images which I will be using multiple times. What should be the best place to save them?

Also, these images will rarely change like once in a week kind of. So how and when should I trigger the image refreshing without hampering the app experience.


I assume you’re referring to ~/Libraries/Caches/. The system doesn’t automatically remove stuff there, so the answer is “indefinitely”. If you’ll be adding unbounded amounts of data, you need to clean it out yourself.

Keep in mind that by putting data there you’re effectively promising that your app won’t break if it’s deleted at any time, and it won’t be backed up.


Just refresh the images in the cache when you download new ones. Downloading new ones depends on the images, and where they are used. Eg you could cache the Cocoa-Cola Logo indefinitely as it never changes, but say the Google logo (including the doodles) should be checked for pretty much every day, as it can change (like it has changed today)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜