Viki::Core::Fetcher - honor "Cache-Control" max-age for public resources

For some requests, the Viki api returns a "Cache-Control" header.
This header is in the following format:

    <PRIVACY_LEVEL><COMMA><SP>max-age=<MAX-AGE-SECONDS>

where
PRIVACY_LEVEL is one of "public" of "private"
<COMMA> is the ',' character
<SP> is the ' ' character
<MAX-AGE-SECONDS> is an integer

An example of this is:

    public, max-age=900

This was not peviously taken into account for caching, which means that
we always make use of the default caching time of 5s.

Now, we teach Viki::Core::Fetcher to honor the "Cache-Control" header
for "public" resources, and use the value of "max-age" as the cache
timing, instead of the default caching time. Reasons are:

1. Viki::Core::Fetcher only issues GET requests, which are the only kind
   of requests we cache.
2. To be safe, we only cache stuff that's labelled "public" and not
   "private".
3. The max-age value give the duration for which the response is valid,
   and probably has a larger value than the default caching time of 5s.
   This should hopefully bring up Raynor's cache hit ratio slightly.

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Add a few more fetcher specs

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Fetcher#on_complete - remove extra '.' from 'headers..respond_to?'

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Core::Fetcher - allow for possibly random position of 'max-age' value

This patch addresses the issue of the 'max-age=\d+' pattern in the
Cache-Control header possibly being in a different position than the 1st
position. In other words, our current implementation only works for:

    public, max-age=XYZ

But now, the entire Cache-Control header value is split apart by commas,
stripped of leading and trailing whitespace, then inspected for presence
of 'public' and 'max-age=' values. If so, then we use the value of
max-age for caching.

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Fetcher#on_complete - change map &:strip to map { |s| s.strip }

Due to the former being slower

Signed-off-by: Pang Yan Han <pangyanhan@gmail.com>
Merge pull request #30 from viki-org/honor_cache_control_header_two

Honor cache control header