开发者

ASIHTTP Cache POST GET

I would开发者_高级运维 like to use ASIHTTP to manage caching some JSON requests. Originally I though all I had to do was this:

[ASIHTTPRequest setDefaultCache:[ASIDownloadCache sharedCache]];

http://allseeing-i.com/ASIHTTPRequest/How-to-use

However after testing I can see that nothing is being cached. I think this is because ASI cacheing only works with GET and I'm using POST. I want to try sending a GET but I can see how. I've tried setting the request method but no change.

[request setRequestMethod:@"GET"];


Try to use a different cache policy using setCachePolicy.

With ASIOnlyLoadIfNotCachedCachePolicy you can enforce to use the cached response if it exists.


Find this in ASIDownloadCache.m.

if (![[self requestMethod] isEqualToString:@"GET"]) {
        [self setDownloadCache:nil];
    }

Now you can use cache with POST method.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜