NsCache
2017-08-08 本文已影响6人
tiGress
NsCache。是苹果官方提供的缓存。NsCache 在系统内存很低的时候,会自动释放对象(但模拟器不会释放),
建议:接受到内存警告的时候,主动调用removeallobjects 释放对象。
NsCache 是线程安全的,在多线程操作中,不需要对NsCache进行加锁。
NsCache 的key 只是对对象进行strong引用,不是拷贝。
name:名称
delegate;设置代理
totalCostLimit :缓存空间的最大成本,超出上限会自动收回对象。默认为0,表示没有限制。。
countLimit:能够缓存的对象的最大数量。默认为0,表示没有限制。




