Page MenuHomePhabricator

Replace PageCache with Retrofit OkHttp caching
Closed, ResolvedPublic

Description

We should leverage networking libraries that specialize in network requests and caching rather than maintaining a custom cache implementation for pages alone. This task encompasses the work to remove PageCache and add any missing pieces needed to replace the functionality with a Retrofit OkHttp implementation. A subsequent task may investigate replacing saved pages with a Retrofit cached page that doesn't expire.

Some references:

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 19 2016, 7:13 PM

We think that PageCache isn't really doing a whole lot now and that it can be removed without a lot of impact and OkHttp will just kind of work without any extra code. We should also always try from network as the cache is tried under the covers by OkHttp.

bearND added a subscriber: bearND.Oct 19 2016, 8:31 PM

As I mentioned in our meeting, we need to make sure we test also cases where we use the action API for the page content. This is important since there we don't get the etag headers. Retrofit/OkHttp won't use the If-None-Match headers if it doesn't get an etag from previous responses.

  • Don't show images: looks like there could be a workaround for it client-side, I think dbrant has a patch for that.
  • zhwiki due to T122942: RFC: Support language variants in the REST API
  • we still have a fallback to the action API if things go wrong with RB requests (but we could get rid of that in the future)

Change 316852 had a related patch set uploaded (by Niedzielski):
WIP: Replace PageCache with OkHttp caching

https://gerrit.wikimedia.org/r/316852

If you haven't already, it would be good to run through the problem scenario in T152720: Pages should be cached using the canonical title and see how Retrofit handles caching -- specifically whether it's sophisticated enough to recognize and appropriately handle the redirect.

I've been meaning to dig into the Retrofit documentation on caching but haven't got to it yet.

Change 334454 had a related patch set uploaded (by Niedzielski):
Update: allow OkHttp Cache to serve stale responses

https://gerrit.wikimedia.org/r/334454

Change 316852 merged by jenkins-bot:
Replace PageCache with OkHttp caching

https://gerrit.wikimedia.org/r/316852

Change 334454 merged by jenkins-bot:
Update: allow OkHttp Cache to serve stale responses

https://gerrit.wikimedia.org/r/334454

Dbrant closed this task as Resolved.Feb 10 2017, 3:00 PM