Skip to content

Commit

Permalink
⚡️ [iOS] Improve cache container mutations (#803)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexV525 authored Jul 14, 2022
1 parent 81c062a commit 4b693e2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ that can be found in the LICENSE file. -->
### Improvements

- Improve `MD5Utils` on iOS. (#802)
- Improve cache container mutations on iOS. (#803)

### Fixes

Expand Down
8 changes: 6 additions & 2 deletions ios/Classes/core/PMCacheContainer.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,19 @@ - (instancetype)init {
}

- (void)putAssetEntity:(PMAssetEntity *)entity {
map[entity.id] = entity;
@synchronized (map) {
self->map[entity.id] = entity;
}
}

- (PMAssetEntity *)getAssetEntity:(NSString *)id {
return map[id];
}

- (void)clearCache {
[map removeAllObjects];
@synchronized (map) {
[self->map removeAllObjects];
}
}

@end

0 comments on commit 4b693e2

Please sign in to comment.