First pass at replacing RKManagedObjectCache with a more flexible block approach that leverages the new resource path pattern matching approach to registering objectMappings.

This commit is contained in:
Jeff Arena
2012-01-26 16:52:38 -05:00
committed by Blake Watters
parent 0660f28fc1
commit 1cd22d5b33
28 changed files with 1091 additions and 372 deletions

View File

@@ -19,7 +19,8 @@
//
#import <CoreData/CoreData.h>
#import "RKManagedObjectCache.h"
#import "RKManagedObjectMapping.h"
#import "RKManagedObjectMappingCache.h"
@class RKManagedObjectStore;
@@ -51,7 +52,6 @@ extern NSString* const RKManagedObjectStoreDidFailSaveNotification;
NSString* _pathToStoreFile;
NSManagedObjectModel* _managedObjectModel;
NSPersistentStoreCoordinator* _persistentStoreCoordinator;
NSObject<RKManagedObjectCache>* _managedObjectCache;
}
// The delegate for this object store
@@ -67,12 +67,6 @@ extern NSString* const RKManagedObjectStoreDidFailSaveNotification;
@property (nonatomic, readonly) NSManagedObjectModel* managedObjectModel;
@property (nonatomic, readonly) NSPersistentStoreCoordinator* persistentStoreCoordinator;
/**
* Managed object cache provides support for automatic removal of objects pruned
* from a server side load. Also used to provide offline object loading
*/
@property (nonatomic, retain) NSObject<RKManagedObjectCache>* managedObjectCache;
///-----------------------------------------------------------------------------
/// @name Accessing the Default Object Store
///-----------------------------------------------------------------------------
@@ -84,6 +78,11 @@ extern NSString* const RKManagedObjectStoreDidFailSaveNotification;
/// @name Initializing an Object Store
///-----------------------------------------------------------------------------
/**
*/
@property (nonatomic, retain) NSObject<RKManagedObjectMappingCache> *cacheStrategy;
/**
* Initialize a new managed object store with a SQLite database with the filename specified
*/
@@ -135,21 +134,6 @@ extern NSString* const RKManagedObjectStoreDidFailSaveNotification;
*/
- (NSArray*)objectsWithIDs:(NSArray*)objectIDs;
/**
* Retrieves a model object from the object store given a Core Data entity and
* the primary key attribute and value for the desired object. Internally, this method
* constructs a thread-local cache of managed object instances to avoid repeated fetches from the store
*/
- (NSManagedObject*)findOrCreateInstanceOfEntity:(NSEntityDescription*)entity withPrimaryKeyAttribute:(NSString*)primaryKeyAttribute andValue:(id)primaryKeyValue;
/**
* Returns an array of objects that the 'live' at the specified resource path. Usage of this
* method requires that you have provided an implementation of the managed object cache
*
* See managedObjectCache above
*/
- (NSArray*)objectsForResourcePath:(NSString*)resourcePath;
///-----------------------------------------------------------------------------
/// @name Retrieving Managed Object Contexts
///-----------------------------------------------------------------------------