As we expand beyond Parsoid we need a way to expose and (optionally) store relatively simple responses from backend services. We should make this module fairly generic, so that we can easily configure it to support many services with similar caching needs.
Use cases:
- Citoid
- store JSON blob per `format` and `search` parameter (key), if response was 200
- [Graphoid](https://www.mediawiki.org/wiki/Extension:Graph#Graphoid_Service}
- store image under hash key
- forward title, rev, hash to service on cache miss: /PageTitle/12345/a64b022a8fa5b7fc5e40a2c95cd0a114b2ae1174.png
Requirements:
- Provide an internal service end point, and map requests to storage & backend service requests. The backend request format needs to be configurable.
- URI format in spec needs to define `key` and optionally `revision`.
- Store responses from GETs, and only if no query parameters were supplied.
- Optionally (if configured) support refreshing content with a `Cache-control: no-cache` header.
Draft module config in config.yaml:
```
/{module:kv_cache}:
x-modules:
- name: kv_cache
version: 1.0.0
type: file
options:
paths:
/someservice/foo/{key}:
get:
backend_request:
uri: http://some.svc.eqiad.wmnet:12345/{key}
storage:
bucket: someservice.foo
no-cache_refresh: true
```