Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle cache in diskOperation #7

Open
huntrax11 opened this issue Jun 8, 2011 · 0 comments
Open

Handle cache in diskOperation #7

huntrax11 opened this issue Jun 8, 2011 · 0 comments

Comments

@huntrax11
Copy link

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;
    }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant