The NSURLCache class provides a method by which one can dump the entire contents of the cache (-removeAllCachedResponses). What doesn't seem to be available, and would seem to be useful on iOS, would be a way to clear the contents of the in-memory cache, but not drop the items on disk. (The scenario being responding to a memory warning, where you need to free up storage, but clearing out disk space doesn't have any value.)
Seems like the implementation might be as simple as:
The
NSURLCache
class provides a method by which one can dump the entire contents of the cache (-removeAllCachedResponses
). What doesn't seem to be available, and would seem to be useful on iOS, would be a way to clear the contents of the in-memory cache, but not drop the items on disk. (The scenario being responding to a memory warning, where you need to free up storage, but clearing out disk space doesn't have any value.)Seems like the implementation might be as simple as:
(With the obvious down side that if the Foundation implementation ever gains disk caching, this would be bad.)