vimeo / vimeo/vimeo-networking-java

Force cache invalidation on API version change

Open
#252 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Kotlin
Stars
128
Forks
48
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how the Retrofit cache is stored and where the API version is detected. Decide how the current version will be persisted, then verify that a detected version change invalidates the cache without requiring the consumer to expose the API version; the proposed KeyValueStorage interface is one option mentioned in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.