Force cache invalidation on API version change

未关闭
#252 1 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
kotlin
领域
api

调研方向

首先追踪 Retrofit 缓存的存储方式以及 API 版本的检测位置。确定当前版本的持久化方式,然后验证检测到版本变化时,缓存会失效,而无需消费者公开 API 版本;issue 中提到的拟议 KeyValueStorage 接口是其中一个选项。

由索引模型根据 Issue 内容生成。

描述

bug
Issue Summary

When the API version changes, the cache is not cleared. This creates a potential for serialization crashes due to changes in object representations.

Suggested Improvements

Since the API version is no longer exposed to the library consumer, we should invalidate the retrofit cache when we detect an API version change internally. This will require us to persist the current version of the API to disk. We should do this either using a flat file (since this is a java library) or force the consumer to provide an implementation of an interface that writes and retrieves key value pairs to disk.

interface KeyValueStorage {
    fun storeStringForKey(key: String, value: String?)

    fun retrieveStringForKey(key: String): String?
}

Then we will force cache invalidation any time we detect a change in the API Version.

主要语言
Kotlin
星标
128
派生
48
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

vimeo/vimeo-networking-java 的其他 Issue

查看 vimeo/vimeo-networking-java 的全部 Issue

相似的 Issue

更多 Kotlin Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。