# NSURLCache documentation

rfm@gnu.org
Generated at 2025-12-02 21:52:00 +0000
2006 Software Foundation, Inc.
Software documentation for the NSCachedURLResponse class
Foundation/NSURLCache.h
NSCoding
NSCopying
Encapsulates a cached response to a URL load request.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
data
Returns the data with which the receiver was initialised.
initWithResponse:
response
data:
data
Uses the NSURLCacheStorageAllowed policy to cache the specified response and data .
Returns the cached response.
initWithResponse:
response
data:
data
userInfo:
userInfo
storagePolicy:
storagePolicy
Returns the receiver initialized with the provided parameters.
response
Returns the response with which the receiver was initialised.
storagePolicy
Returns the storage policy with which the receiver was initialised.
userInfo
Returns the user info dictionary with which the receiver was initialised (if any).
Software documentation for the NSURLCache class
Foundation/NSURLCache.h
Description forthcoming.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
setSharedURLCache:
cache
Sets the shared NSURLCache used throughout the process.
If you are going to call this method to specify an alternative to the default cache, you should do so before the shared cache is used in order to avoid loss of data that was in the old cache.
sharedURLCache
Returns the shared cache instance set by +setSharedURLCache: or, if none has been set, returns an instance initialised with
Memory capacity
4 megabytes
Disk capacity
20 megabytes
Disk path
user-library-path/Caches/current-app-name
cachedResponseForRequest:
request
Returns the NSCachedURLResponse cached for the specified request or `nil` if there is no matching response in tthe cache.
currentDiskUsage
Returns the current size (butes) of the data stored in the on-disk cache.
currentMemoryUsage
Returns the current size (butes) of the data stored in the in-memory cache.
diskCapacity
Returns the disk capacity (in bytes) of the cache.
initWithMemoryCapacity:
memoryCapacity
diskCapacity:
diskCapacity
diskPath:
path
Returns the receiver initialised with the specified capacities (in bytes) and using the specified location on disk for persistent storage.
memoryCapacity
Returns the memory capacity (in bytes) of the cache.
removeAllCachedResponses
Empties the cache.
removeCachedResponseForRequest:
request
Removes from the cache (if present) the NSCachedURLResponse which was stored using the specified request.
setDiskCapacity:
diskCapacity
Sets the disk capacity (in bytes) truncating cache contents if necessary.
setMemoryCapacity:
memoryCapacity
Sets the memory capacity (in bytes) truncating cache contents if necessary.
storeCachedResponse:
cachedResponse
forRequest:
request
Stores cachedResponse in the cache, keyed on request.
Replaces any existing response with the same key.
Software documentation for the NSURLCache(NSURLSessionTaskAdditions) category
Foundation/NSURLCache.h
Description forthcoming.
cachedResponseForDataTask:
dataTask
Description forthcoming.
removeCachedResponseForDataTask:
dataTask
Description forthcoming.
storeCachedResponse:
cachedResponse
forDataTask:
dataTask
Description forthcoming.