A blog for technology, SEO tips, website development and open source programming.

The Magic of LRU Cache

0 894

Cache is a common problem in Android Development and in software engineering. A lot of developers had the same problem scenario is to load a new bitmap for your apps’ social media stream, or whatever, but you’re out of memory. You can’t load in the new bitmap, without first destroying one of the existing bitmaps already in memory. But, which one should you get rid of? Android’s LRUCache container  keeps a list of objects, and ranks them based upon how many times they’ve been accessed. When it’s time to evict one of them (to make space for a new object) the LRUCache already knows which ones to get rid of. All done without you having to worry about any of it.

100 Days of Google Dev / 100 developer videos over 100 days / #GoogleDev100

Leave a Reply

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More