Repository for experiments with cache implementation in okhttp. Made public to illustrate this question.
- Make
GETrequest withno-cache.
- Server responds
200and returnsCache-Control: privatewithETag: W/qwerty.
- We can verify this using proxy.
- After this the response goes into the cache as expected.
- Make
GETrequest withno-cacheagain. It will not be sent as a conditional request. There is noIf-None-Matchheader added and therefore no304response.
- Make
GETrequest with missingCache-Controlheader.
- And now we see a conditional request.
no-cachein okhttp never hits the cache.- Missing
Cache-Controlallows to use a private cache and not read the response body.
There are prebuilt binaries
# Client Android App
adb install android-app-debug.apk# REST API String App
java -jar spring-app-fat.jar
# Requires Java 21
JAVA_HOME="$JAVA_HOME_21" java -jar spring-app-fat.jarOr you can build them from source
cd android/
JAVA_HOME="$JAVA_HOME_17" ./gradlew app:assemble
adb install app/build/outputs/apk/debug/app-debug.apkcd spring/
JAVA_HOME="$JAVA_HOME_21" ./mvnw clean spring-boot:run






