MBCacheWriteOperation Class Reference

Inherits from MBFileWriteOperation : NSOperation
Declared in MBCacheOperations.h

Overview

An NSOperation subclass used by MBFilesystemCaches to handle persistence for cache objects.

MBCacheWriteOperation instances are typically added to the MBCacheWriteQueue singleton for performing cache operations such as this.

Object lifecycle

+ operationForWritingObject:toFile:forCache:

Creates a new MBCacheWriteOperation instance that can be used to write a cache object to a file.

+ (nonnull instancetype)operationForWritingObject:(nonnull id)obj toFile:(nonnull NSString *)path forCache:(nonnull MBFilesystemCache *)fc

Parameters

obj

The cache object to be written to a file.

path

The filesystem path of the file to be written by the returned operation.

fc

The MBFilesystemCache responsible for managing the cached object obj.

Return Value

The newly-created MBFileWriteOperation instance.

Declared In

MBCacheOperations.h

– initWithObject:inCache:forFilePath:

Initializes the receiver so it can be used to write to the specified file.

- (nonnull instancetype)initWithObject:(nonnull id)obj inCache:(nonnull MBFilesystemCache *)fc forFilePath:(nonnull NSString *)path

Parameters

obj

The cache object to be written to a file.

fc

The MBFilesystemCache responsible for managing the cached object obj.

path

The filesystem path of the file to be written by the returned operation.

Return Value

The receiver.

Declared In

MBCacheOperations.h

Getting information about the operation

  cacheObject

Returns the cache object to be written to the filesystem by this operation.

@property (nonnull, nonatomic, readonly) id cacheObject

Declared In

MBCacheOperations.h

  cache

Returns the MBFilesystemCache instance responsible for managing the cache object associated with this operation.

@property (nonnull, nonatomic, readonly) MBFilesystemCache *cache

Declared In

MBCacheOperations.h