Implementing the cache with a SoftReference for avoiding memory leaks.