RKManagedObjectCaching Protocol Reference
Declared in | RKManagedObjectCaching.h |
Overview
Objects implementing the RKManagedObjectCaching protocol can act as the cache strategy for RestKit managed object stores. The managed object cache is consulted when objects are retrieved from Core Data during object mapping operations and provide an opportunity to accelerate the mapping process by trading memory for speed.
Tasks
-
– findInstanceOfEntity:withPrimaryKeyAttribute:value:inManagedObjectContext:
Retrieves a model object from the object store given a Core Data entity and the primary key attribute and value for the desired object.
required method -
– findInstancesOfEntity:withPrimaryKeyAttribute:value:inManagedObjectContext:
Retrieves an array of model objects from the object store given a Core Data entity and the primary key attribute and value for the desired object.
required method -
– didFetchObject:
Tells the receiver that an object was fetched and should be added to the cache.
-
– didCreateObject:
Tells the receiver that an object was created and should be added to the cache.
-
– didDeleteObject:
Tells the receiver that an object was deleted and should be removed to the cache.
Instance Methods
didCreateObject:
Tells the receiver that an object was created and should be added to the cache.
- (void)didCreateObject:(NSManagedObject *)object
Parameters
- object
The object that was created in a managed object context.
Declared In
RKManagedObjectCaching.h
didDeleteObject:
Tells the receiver that an object was deleted and should be removed to the cache.
- (void)didDeleteObject:(NSManagedObject *)object
Parameters
- object
The object that was deleted from a managed object context.
Declared In
RKManagedObjectCaching.h
didFetchObject:
Tells the receiver that an object was fetched and should be added to the cache.
- (void)didFetchObject:(NSManagedObject *)object
Parameters
- object
The object that was fetched from a managed object context.
Declared In
RKManagedObjectCaching.h
findInstanceOfEntity:withPrimaryKeyAttribute:value:inManagedObjectContext:
Retrieves a model object from the object store given a Core Data entity and the primary key attribute and value for the desired object.
- (NSManagedObject *)findInstanceOfEntity:(NSEntityDescription *)entity withPrimaryKeyAttribute:(NSString *)primaryKeyAttribute value:(id)primaryKeyValue inManagedObjectContext:(NSManagedObjectContext *)managedObjectContext
Parameters
- entity
The Core Data entity for the type of object to be retrieved from the cache.
- primaryKeyAttribute
The name of the attribute that acts as the primary key for the entity.
- primaryKeyValue
The value for the primary key attribute of the object to be retrieved from the cache.
- mmanagedObjectContext
The managed object context to be searched for a matching instance.
Return Value
A managed object that is an instance of the given entity with a primary key and value matching the specified parameters, or nil if no object was found.
Declared In
RKManagedObjectCaching.h
findInstancesOfEntity:withPrimaryKeyAttribute:value:inManagedObjectContext:
Retrieves an array of model objects from the object store given a Core Data entity and the primary key attribute and value for the desired object.
- (NSArray *)findInstancesOfEntity:(NSEntityDescription *)entity withPrimaryKeyAttribute:(NSString *)primaryKeyAttribute value:(id)primaryKeyValue inManagedObjectContext:(NSManagedObjectContext *)managedObjectContext
Parameters
- entity
The Core Data entity for the type of object to be retrieved from the cache.
- primaryKeyAttribute
The name of the attribute that acts as the primary key for the entity.
- primaryKeyValue
The value for the primary key attribute of the object to be retrieved from the cache.
- mmanagedObjectContext
The managed object context to be searched for a matching instance.
Return Value
An array of managed objects that are instances of the given entity with a primary key and value matching the specified parameters, or nil if no object was found.
Declared In
RKManagedObjectCaching.h