viki-org/viki-api-gem — pull request #29 by yanhan (2014-01-08 04:05:01+00:00)
Title: Viki::Core::Fetcher - Honor "Cache-Control" header

Viki::Core::Fetcher only issues GET requests, and that is what
we are interested in caching. Some API responses return a
"Cache-Control" header in the following format:

public, max-age=

where is the number of seconds the response
should be valid.

In this patch series, we teach Viki::Core::Fetcher to honor the
Cache-Control header for responses from the API server with the
above stated format, and use the value of max-age as the number
of seconds to cache, instead of the default of 5 seconds.

Hopefully, the max-age value will be much higher than 5 seconds,
and this should slightly improve Raynor's cache hit ratio.