cache.md 976 B

net / com.drake.net.scope / NetCoroutineScope / cache

cache

fun cache(error:Boolean= false, animate:Boolean= false, onCache: suspend CoroutineScope.() ->Unit):AndroidScope

该函数一般用于缓存读取 只在第一次启动作用域时回调 该函数在作用域launch之前执行 函数内部所有的异常都不会被抛出, 也不会终止作用域执行

Parameters

error - 是否在缓存读取成功但网络请求错误时吐司错误信息

animate - 是否在缓存成功后依然显示加载动画

onCache - 该作用域内的所有异常都算缓存读取失败, 不会吐司和打印任何错误