EGOCache icon indicating copy to clipboard operation
EGOCache copied to clipboard

Handle cache in diskOperation

Open huntrax11 opened this issue 13 years ago • 0 comments

would you like to handle cache in disk operation? You know some code like above-

  • (NSData_)dataForKey:(NSString_)key { if([self hasCacheForKey:key]) { return [NSData dataWithContentsOfFile:cachePathForKey(key) options:0 error:NULL]; } else { for(NSInvocationOperation* operation in [diskOperationQueue operations]){ NSInvocation *invocation=[operation invocation]; NSString *path=nil; NSData *data=nil; [invocation getArgument:&path atIndex:3]; if([path hasSuffix:key]){ [invocation getArgument:&data atIndex:2]; return data; } } return nil; } }

huntrax11 avatar Jun 08 '11 05:06 huntrax11