Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions TMCache/TMMemoryCache.m
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,10 @@ - (void)setObject:(id)object forKey:(NSString *)key withCost:(NSUInteger)cost bl
if (strongSelf->_willAddObjectBlock)
strongSelf->_willAddObjectBlock(strongSelf, key, object);

NSNumber *oldCost = [strongSelf->_costs objectForKey:key];
if (oldCost)
_totalCost -= [oldCost unsignedIntegerValue];

[strongSelf->_dictionary setObject:object forKey:key];
[strongSelf->_dates setObject:now forKey:key];
[strongSelf->_costs setObject:@(cost) forKey:key];
Expand Down