ios - AFNetworking different cache settings for different content -



ios - AFNetworking different cache settings for different content -

i'm using afnetworking 2 with:

nsurlcache *sharedcache = [[nsurlcache alloc] initwithmemorycapacity:2 * 1024 * 1024 diskcapacity:100 * 1024 * 1024 diskpath:nil]; [nsurlcache setsharedurlcache:sharedcache];

and have different type of content:

small content changes , has long expiration date small content changes , has little expiration date big images (100kb-200kb)

what if user open 100 big images , these images take cache memory? think big image replace little content hasn't expired yet. how can prepare it? can split memory 2 sections (first little content, sec big images) or should utilize different afhttpsessionmanager subclasses different cache policy types of content?

all cacheable url requests utilize same nsurlcache, whether you're using afnetworking or not. creating new afnetworking session manager won't create difference.

nsurlcache move older requests memory disk. it's not in documentation, i'd bet if stuff getting purged, nsurlcache weigh frequency of access against expiration date when deciding rid of.

if need guarantee info available, should write disk yourself. otherwise, should allow nsurlcache thing.

if don't answer, 1 alternative utilize library sdwebimage (or roll own), doesn't utilize nsurlcache implements own separate caching mechanisms. way big images won't interfere cache.

ios caching afnetworking afnetworking-2

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -