movableink/CORS-Proxy — pull request #1 by mnutt (2014-02-26 20:55:03+00:00)
Title: Mn/cache

This adds a caching layer to cors-proxy. Requests will hit one of three states: MISS, WAIT, and HIT. MISS happens when the cache is completely cold. If a request is in flight to the backend and a second request comes in, it will get put in the WAIT state and receive the content from the result of the first request. If the first request has already returned content and is not stale, the content will be served from the cache.

Cache length is 15s by default, but can be set by passing an X-Reverse-Proxy-TTL header.

This was originally forked off another project without tests and slowly migrated to an internally maintained project, but my intention is to add a test suite to this to give us a bit more confidence. It won't be particularly easy since the entire app is mostly glue between different components. But albert needs to start testing a campaign with this today, so I've been manually testing in the meantime.