Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 .cacheOnDisc() 方法将图像存储在缓存中(默认方法-无限外部存储)。我应该为我的应用程序启用 cacheInMemory 吗?如果我不使用 cacheInMemory 选项会有什么影响?
内存缓存将图像缓存在内存 (RAM) 中,即它不必从内部存储中加载和解码图像,因为这相当慢。您应该 IMO 始终使用内存缓存。
不使用内存缓存的影响可能是 - 根据实现 - 滚动图像列表要么结结巴巴,要么比必要的慢。
如果图像是从 Internet 下载的,并且您不想在每次应用程序重新启动时重新下载它们,则磁盘(例如 SD 卡)缓存是有意义的。本地存储比互联网快得多,但仍比内存慢得多。