Skip to content

Commit 2fa3aec

Browse files
author
Mallory Paine
committed
Remove -saveMetadata from FICImageTable header, and always call -saveMetadata when deleting
1 parent 1e7ff51 commit 2fa3aec

3 files changed

Lines changed: 2 additions & 19 deletions

File tree

FastImageCache/FICImageCache.m

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,10 +368,8 @@ - (BOOL)imageExistsForEntity:(id <FICEntity>)entity withFormatName:(NSString *)f
368368

369369
- (void)deleteImageForEntity:(id <FICEntity>)entity withFormatName:(NSString *)formatName {
370370
FICImageTable *imageTable = [_imageTables objectForKey:formatName];
371-
NSString *entityUUID = [entity UUID];
372-
371+
NSString *entityUUID = [entity UUID];
373372
[imageTable deleteEntryForEntityUUID:entityUUID];
374-
[imageTable saveMetadata];
375373
}
376374

377375
- (void)cancelImageRetrievalForEntity:(id <FICEntity>)entity withFormatName:(NSString *)formatName {

FastImageCache/FICImageTable.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -150,20 +150,6 @@ extern NSString *const FICImageTableScreenScaleKey;
150150
*/
151151
- (BOOL)entryExistsForEntityUUID:(NSString *)entityUUID sourceImageUUID:(NSString *)sourceImageUUID;
152152

153-
///---------------------------------------
154-
/// @name Saving an Image Table's Metadata
155-
///---------------------------------------
156-
157-
/**
158-
Saves the image table's metadata to disk.
159-
160-
@discussion `FICImageTable` objects load their metadata from disk when they are initialized. If the deserialized dictionary representation for an image table's image format does not
161-
match the current dictionary representation, then the image table is invalid. The image table is deleted and a new one is created from the modified image format.
162-
163-
@see [FICImageFormat dictionaryRepresentation]
164-
*/
165-
- (void)saveMetadata;
166-
167153
///--------------------------------
168154
/// @name Resetting the Image Table
169155
///--------------------------------

FastImageCache/FICImageTable.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,6 @@ - (UIImage *)newImageForEntityUUID:(NSString *)entityUUID sourceImageUUID:(NSStr
330330
if (entityUUIDIsCorrect == NO || sourceImageUUIDIsCorrect == NO) {
331331
// The UUIDs don't match, so we need to invalidate the entry.
332332
[self deleteEntryForEntityUUID:entityUUID];
333-
[self saveMetadata];
334333
} else {
335334
[self _entryWasAccessedWithEntityUUID:entityUUID];
336335

@@ -399,6 +398,7 @@ - (void)deleteEntryForEntityUUID:(NSString *)entityUUID {
399398
if (index != NSNotFound) {
400399
[_MRUEntries removeObjectAtIndex:index];
401400
}
401+
[self saveMetadata];
402402
}
403403

404404
[_lock unlock];
@@ -423,7 +423,6 @@ - (BOOL)entryExistsForEntityUUID:(NSString *)entityUUID sourceImageUUID:(NSStrin
423423
if (entityUUIDIsCorrect == NO || sourceImageUUIDIsCorrect == NO) {
424424
// The source image UUIDs don't match, so the image data should be deleted for this entity.
425425
[self deleteEntryForEntityUUID:entityUUID];
426-
[self saveMetadata];
427426
entryData = nil;
428427
}
429428
}

0 commit comments

Comments
 (0)