ios - Single vs Multiple UIImage Caches -


i'm making app comes stock lots of high-res images initally displayed in various collection views based on tab selected, similar instagram. though images come app i've found caching uiimages asynchronously in simple nsmutabledictionary, oppose reloading them every time, speeds collection views ui ton. right have 1 image cache handles images in app, though spread out on multiple view controllers/collection views , of various sizes. if of these view controllers memory warning cache cleared.

my question is: ideal setup, or make more sense have separate image cache each view controller handles images within respective collection view? thinking way if view controller #3 gets memory warning, image cache cleared allowing view controllers #1 , #2 retain smooth ui.

there better when want cache something, right object nscache, works dictionary, has lot of advantages:

the nscache class incorporates various auto-eviction policies, ensure cache doesn’t use of system’s memory. if memory needed other applications, these policies remove items cache, minimizing memory footprint.
can add, remove, , query items in cache different threads without having lock cache yourself.
unlike nsmutable​dictionary object, cache not copy key objects put it.

about question think there not specific answer. if manage cache correctly can use one, create 1 each collection view use, avoid sharing information.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -