Skip to content

Commit

Permalink
fixed parameter type in call to purgeRevisions: and added a call to c…
Browse files Browse the repository at this point in the history
…lear the document cache after purging
  • Loading branch information
pegli committed Dec 27, 2012
1 parent cfde9f0 commit 8f3bc41
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Source/API/TDDocument.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,16 @@ - (BOOL) deleteDocument: (NSError**)outError {


- (BOOL) purgeDocument: (NSError**)outError {
TDStatus status = [_database.tddb purgeRevisions: @{self.documentID : @"*"} result: nil];
TDStatus status = [_database.tddb purgeRevisions: @{self.documentID : [NSArray arrayWithObject:@"*"]} result: nil];
if (TDStatusIsError(status)) {
if (outError) {
*outError = TDStatusToNSError(status, nil);
return NO;
}
}
else {
[self.database clearDocumentCache];
}
return YES;
}

Expand Down

2 comments on commit 8f3bc41

@snej
Copy link

@snej snej commented on 8f3bc41 Dec 31, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clearing the document cache would be bad, as it would affect other TDDocuments and lead to multiple TDDocument instances for the same document ID. Instead we need to just remove this document ID from the cache.

@pegli
Copy link
Owner Author

@pegli pegli commented on 8f3bc41 Dec 31, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I will add a new method to TDDatabase which removes a specific document from the cache, update purgeDocument, and resubmit the pull request.

Please sign in to comment.