File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,9 @@ typedef NS_ENUM(NSInteger, FCModelSaveResult) {
7979// if you perform SELECTs from multiple threads.
8080+ (NSArray *)allLoadedInstances ;
8181
82+ // Convenient method to clean all loaded (cached) instances
83+ + (void )cleanAllLoadedInstances ;
84+
8285// Feel free to operate on the same database object with your own queries. They'll be
8386// executed synchronously on FCModel's private database-operation queue.
8487// (IMPORTANT: READ THE NEXT METHOD DEFINITION)
Original file line number Diff line number Diff line change @@ -139,6 +139,13 @@ + (NSArray *)allLoadedInstances
139139 return instances;
140140}
141141
142+ + (void )cleanAllLoadedInstances
143+ {
144+ dispatch_semaphore_wait (g_instancesReadLock, DISPATCH_TIME_FOREVER);
145+ [g_instances removeAllObjects ];
146+ dispatch_semaphore_signal (g_instancesReadLock);
147+ }
148+
142149+ (instancetype )instanceWithPrimaryKey : (id )primaryKeyValue { return [self instanceWithPrimaryKey: primaryKeyValue databaseRowValues: nil createIfNonexistent: YES ]; }
143150+ (instancetype )instanceWithPrimaryKey : (id )primaryKeyValue createIfNonexistent : (BOOL )create { return [self instanceWithPrimaryKey: primaryKeyValue databaseRowValues: nil createIfNonexistent: create]; }
144151
You can’t perform that action at this time.
0 commit comments