Skip to content

Commit

Permalink
Merge pull request airbnb#1119 from BenziAhamed/patch-1
Browse files Browse the repository at this point in the history
Fix LRUAnimationCache to evict cached items
  • Loading branch information
buba447 committed Apr 23, 2020
2 parents 05d9696 + beab7b6 commit da8ecb8
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ public class LRUAnimationCache: AnimationCacheProvider {
cacheMap[forKey] = animation
lruList.append(forKey)
if lruList.count > cacheSize {
lruList.remove(at: 0)
let removed = lruList.remove(at: 0)
if removed != forKey {
cacheMap[removed] = nil
}
}
}

Expand Down

0 comments on commit da8ecb8

Please sign in to comment.