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

SDURLCache and NSURLRequestReturnCacheDataDontLoad #32

Open
raulperez opened this issue Apr 19, 2012 · 1 comment
Open

SDURLCache and NSURLRequestReturnCacheDataDontLoad #32

raulperez opened this issue Apr 19, 2012 · 1 comment

Comments

@raulperez
Copy link

I cannot use properly SDURLCache disk.

When I use NSURLCache NSURLRequestReturnCacheDataDontLoad policy works properly but when I add SDURLCache doesn't return cached requests.

Somebody could help me?

Thanks in advance,

Raúl Pérez

@raulperez
Copy link
Author

We were working around why SDURLCache won't work and the real problem it's that SDURLCache doesn't create the disk.

Here is the code:

NSString *cachePath = [SDURLCache defaultCachePath];

SDURLCache *sharedCache = [[SDURLCache alloc] initWithMemoryCapacity:1024*1024 
                                                        diskCapacity:1024*1024*5 
                                                            diskPath:cachePath];

[SDURLCache setSharedURLCache:sharedCache];
[sharedCache release];  

Here is the log:

2012-04-20 13:22:52.798 Cache[16797:b603] Cache Path 1: /Users/raul/Library/Application Support/iPhone Simulator/5.1/Applications/27337EE6-A788-4F5C-8EA0-1C2551B2D1C2/Library/Caches/SDURLCache
2012-04-20 13:22:52.800 Cache[16797:b603] Cache memory capacity = 1048576 bytes
2012-04-20 13:22:52.801 Cache[16797:b603] Cache disk capacity = 5242880 bytes
2012-04-20 13:22:52.801 Cache[16797:b603] Cache memory usage = 0 bytes
2012-04-20 13:22:52.802 Cache[16797:b603] Cache disk usage = 0 bytes
2012-04-20 13:22:52.897 Cache[16797:b603] Content lenght: 42406
2012-04-20 13:22:52.898 Cache[16797:b603] Connection did receive data
2012-04-20 13:22:52.898 Cache[16797:b603] Connection did receive data
2012-04-20 13:22:52.899 Cache[16797:b603] Caching response...
2012-04-20 13:22:52.900 Cache[16797:b603] headers: {
"Accept-Ranges" = bytes;
Connection = "Keep-Alive";
"Content-Length" = 42406;
"Content-Type" = "application/xml";
Date = "Fri, 20 Apr 2012 11:22:52 GMT";
Etag = ""12e6dd7-a5a6-4be058b6af880"";
"Keep-Alive" = "timeout=15, max=100";
"Last-Modified" = "Thu, 19 Apr 2012 10:22:10 GMT";
Server = "Apache/2.2.21 (Unix) DAV/2";
}
2012-04-20 13:22:52.900 Cache[16797:b603] Received Data Lenght: 42406 bytes
2012-04-20 13:22:52.901 Cache[16797:b603] Cache memory capacity = 1048576 bytes
2012-04-20 13:22:52.901 Cache[16797:b603] Cache disk capacity = 5242880 bytes
2012-04-20 13:22:52.902 Cache[16797:b603] Cache memory usage = 0 bytes
2012-04-20 13:22:52.903 Cache[16797:b603] Cache disk usage = 0 bytes
Any solutions?

Regards,

Raúl Pérez

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