16年时候会布局会简单的listView 咱就能工作了,现在非要这么卷吗?
问你缓存策略,问你生命周期、问你里面各中设计模式 都是同行为什么要这样死逼呢?
Glide的缓存
简单的使用:
Glide.with(this).load("").into(null)
先简单的记 with是绑定页面生命周期(防止内存泄露) load 是构建请求(像 okhttp 构建Request一样) into方法就像okhttp client执行enqueue方法一样
那么缓存我们就从into方法看 前面的先不看 因为咱们主要是看缓存
注意这里的Target 我们把它作一个回调(像okhttp 的 CallBack一样)
![](https://img-blog.csdnimg.cn/img_convert/8ee04bd43eadc85de976391c1212a030.png)
image.png
![](https://img-blog.csdnimg.cn/img_convert/8fcfd895dfcfd9b33de39593f8912773.png)
image.png
我们进入到super.into(view)
![](https://img-blog.csdnimg.cn/img_convert/83ec9081b4de932592fc216395d33452.png)
image.png
![](https://img-blog.csdnimg.cn/img_convert/db744f65fbb6d4a47c460b01dd0b0449.png)
image.png
![](https://img-blog.csdnimg.cn/img_convert/6435118e62d8b899dcb96be00a67b3e4.png)
image.png
注意这里 (看英文意思 开始请求)
![](https://img-blog.csdnimg.cn/img_convert/6cb7cdef4648314a19f3223415794581.png)
image.png
这里Request是一个接口
![](https://img-blog.csdnimg.cn/img_convert/f43165beed2d193d3ab4650701227197.png)
image.png
我们找它的实现类:GenericRequest
![](https://img-blog.csdnimg.cn/img_convert/e8e5c9e2403bc8d843d761f2f614e37e.png)
image.png
![](https://img-blog.csdnimg.cn/img_convert/be493f698cf5b925cfd437de3ca6e226.png)
image.png
![](https://img-blog.csdnimg.cn/img_convert/281a12756a00a6a63f74f193381e73db.png)
image.png
至此我们找到了入口
![](https://img-blog.csdnimg.cn/img_convert/d0ab4fce78c51e843592b1d478855f0c.png)
image.png