Is there any way to cache ASIFormDataRequest?

322 Views Asked by At

I'm using ASIFormDataRequest for Post data then parsing with JSON. ASIHTTPRequest has built in caching using [ASIHTTPRequest setDefaultCache:[ASIDownloadCache sharedCache]];. Does anyone know if there is anything similar for ASIFormDataRequest?

Example:

        NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@/myapp/20110715/60b88126/load_dr_daily_schedule/%@/", [self getHost], [dateFormat stringFromDate:today]]];

        ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:url] autorelease];
        [self addCurrentUserLoginToPostRequest:request];        
        [request setPostValue:[dateFormat stringFromDate:today] forKey:@"target_date"];

        [request startSynchronous];

        NSError *error = [request error];
        NSString *responseString;
        if (!error) {
            responseString = [request responseString];
        } else {
            return NULL;
        }
        return [responseString JSONValue];
1

There are 1 best solutions below

4
On BEST ANSWER

ASIFormDataRequest is a subclass of ASIHTTPRequest, so it was the same properties as ASIHTTPRequest.

Note that it won't cache POST requests though.