nscache

How to use NSCache

时光怂恿深爱的人放手 提交于 2019-11-26 08:57:56
问题 Can someone give an example on how to use NSCache to cache a string? Or anyone has a link to a good explanation? I can\'t seem to find any.. 回答1: You use it the same way you would use NSMutableDictionary . The difference is that when NSCache detects excessive memory pressure (i.e. it's caching too many values) it will release some of those values to make room. If you can recreate those values at runtime (by downloading from the Internet, by doing calculations, whatever) then NSCache may suit