如何实现Web资源的缓存? NSURLRequest缓存还是磁盘缓存?

时间:2021-02-20 03:52:53

I have several UITableViews that asynchronously load the images, video, and text from the internet using NSURLRequest and NSURLConnection (Think similar to NYTimes app). That works fine. Currently the content isn't cached. I don't need offline access but just want to cache to speed up performance.

我有几个UITableViews使用NSURLRequest和NSURLConnection异步加载来自互联网的图像,视频和文本(类似于NYTimes应用程序)。这很好。目前,内容未缓存。我不需要离线访问,只想缓存以加快性能。

What would be best:

什么是最好的:

  • Using NSURLRequest and cachePolicy?
  • 使用NSURLRequest和cachePolicy?
  • Saving the images and videos to disk (what about metadata)? How would I store text?
  • 将图像和视频保存到磁盘(元数据怎么样)?我如何存储文字?

1 个解决方案

#1


2  

I used the code here: http://github.com/rs/SDWebImage

我在这里使用了代码:http://github.com/rs/SDWebImage

#1


2  

I used the code here: http://github.com/rs/SDWebImage

我在这里使用了代码:http://github.com/rs/SDWebImage