清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
//进行缓存的步骤: //1.创建单例(返回自己或者id) static DYPDataCache *cache = nil; +(id)sharedInstance{ //保证线程安全 @synchronized(self){ if (cache == nil) { //cache = [[DYPDataCache alloc]init]; //通过[self class]方法可以获取到当前类的类名 cache = [[[self class]alloc]init]; //初始化有效时间 cache.validTime = 20*60; } } return cache; } +(id)allocWithZone:(struct _NSZone *)zone{ if (cache == nil) { cache = [super allocWithZone:zone]; } return cache; }