Up

NSURLCache documentation

Authors

Generated by fedor

Contents -

  1. Software documentation for the NSCachedURLResponse class
  2. Software documentation for the NSURLCache class

Software documentation for the NSCachedURLResponse class

NSCachedURLResponse : NSObject

Declared in:
Foundation/NSURLCache.h
Conforms to:
NSCoding
NSCopying
Availability: MacOS-X 10.2.0, Base 1.13.0

Encapsulates a cached response to a URL load request.

Instance Variables

Method summary

data 

- (NSData*) data;
Availability: MacOS-X 10.2.0, Base 1.13.0

Returns the data with which the receiver was initialised.

initWithResponse: data: 

- (id) initWithResponse: (NSURLResponse*)response data: (NSData*)data;
Availability: MacOS-X 10.2.0, Base 1.13.0

Uses the NSURLCacheStorageAllowed policy to cache the specified response and data .
Returns the cached response.

initWithResponse: data: userInfo: storagePolicy: 

- (id) initWithResponse: (NSURLResponse*)response data: (NSData*)data userInfo: (NSDictionary*)userInfo storagePolicy: (NSURLCacheStoragePolicy)storagePolicy;
Availability: MacOS-X 10.2.0, Base 1.13.0

Returns the receiver initialized with the provided parameters.

response 

- (NSURLResponse*) response;
Availability: MacOS-X 10.2.0, Base 1.13.0

Returns the response with which the receiver was initialised.

storagePolicy 

- (NSURLCacheStoragePolicy) storagePolicy;
Availability: MacOS-X 10.2.0, Base 1.13.0

Returns the storage policy with which the receiver was initialised.

userInfo 

- (NSDictionary*) userInfo;
Availability: MacOS-X 10.2.0, Base 1.13.0

Returns the user info dictionary with which the receiver was initialised (if any).



Instance Variables for NSCachedURLResponse Class

_NSCachedURLResponseInternal

@protected void* _NSCachedURLResponseInternal;
Availability: MacOS-X 10.2.0, Base 1.13.0

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.




Software documentation for the NSURLCache class

NSURLCache : NSObject

Declared in:
Foundation/NSURLCache.h
Availability: MacOS-X 10.2.0, Base 1.13.0

Description forthcoming.

Instance Variables

Method summary

setSharedURLCache: 

+ (void) setSharedURLCache: (NSURLCache*)cache;
Availability: MacOS-X 10.2.0, Base 1.13.0

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 

+ (NSURLCache*) sharedURLCache;
Availability: MacOS-X 10.2.0, Base 1.13.0

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: 

- (NSCachedURLResponse*) cachedResponseForRequest: (NSURLRequest*)request;
Availability: MacOS-X 10.2.0, Base 1.13.0

Returns the NSCachedURLResponse cached for the specified request or nil if there is no matching response in tthe cache.

currentDiskUsage 

- (NSUInteger) currentDiskUsage;
Availability: MacOS-X 10.2.0, Base 1.13.0

Returns the current size (butes) of the data stored in the on-disk cache.

currentMemoryUsage 

- (NSUInteger) currentMemoryUsage;
Availability: MacOS-X 10.2.0, Base 1.13.0

Returns the current size (butes) of the data stored in the in-memory cache.

diskCapacity 

- (NSUInteger) diskCapacity;
Availability: MacOS-X 10.2.0, Base 1.13.0

Returns the disk capacity (in bytes) of the cache.

initWithMemoryCapacity: diskCapacity: diskPath: 

- (id) initWithMemoryCapacity: (NSUInteger)memoryCapacity diskCapacity: (NSUInteger)diskCapacity diskPath: (NSString*)path;
Availability: MacOS-X 10.2.0, Base 1.13.0

Returns the receiver initialised with the specified capacities (in bytes) and using the specified location on disk for persistent storage.

memoryCapacity 

- (NSUInteger) memoryCapacity;
Availability: MacOS-X 10.2.0, Base 1.13.0

Returns the memory capacity (in bytes) of the cache.

removeAllCachedResponses 

- (void) removeAllCachedResponses;
Availability: MacOS-X 10.2.0, Base 1.13.0

Empties the cache.

removeCachedResponseForRequest: 

- (void) removeCachedResponseForRequest: (NSURLRequest*)request;
Availability: MacOS-X 10.2.0, Base 1.13.0

Removes from the cache (if present) the NSCachedURLResponse which was stored using the specified request.

setDiskCapacity: 

- (void) setDiskCapacity: (NSUInteger)diskCapacity;
Availability: MacOS-X 10.2.0, Base 1.13.0

Sets the disk capacity (in bytes) truncating cache contents if necessary.

setMemoryCapacity: 

- (void) setMemoryCapacity: (NSUInteger)memoryCapacity;
Availability: MacOS-X 10.2.0, Base 1.13.0

Sets the memory capacity (in bytes) truncating cache contents if necessary.

storeCachedResponse: forRequest: 

- (void) storeCachedResponse: (NSCachedURLResponse*)cachedResponse forRequest: (NSURLRequest*)request;
Availability: MacOS-X 10.2.0, Base 1.13.0

Stores cachedResponse in the cache, keyed on request.
Replaces any existing response with the same key.



Instance Variables for NSURLCache Class

_NSURLCacheInternal

@protected void* _NSURLCacheInternal;
Availability: MacOS-X 10.2.0, Base 1.13.0

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.





Up