Previously a cache miss would be cached twice - an unversioned entry + a versioned entry for the same cache key. This would allow cases where the versioned entry was not strictly needed and shouldn't cause a cache miss (eg: bot traffic). However, this doubling of the cache entries reduces the effective memory footprint and requires multiple round trips to the backing cache.
This PR collapses the cache to a single key and uses the entity-tag (etag) value for the situations when a strict cache value needs to be evaluated. This reduces the number of queries to the cache while preserving the intended semantics of the cache.
Additionally, we move the a limited header set into the cache. Header caching is required for response metadata caching and will support other use cases such as the use of cache-tags and other cache-control header values.
Other changes in this pr:
refactoring the nominclature (cache_key --> is for the lookup, entity_tag is for the version)
removed the non-standard header x-alternate-cache-key
update gemfile dependency versions
Future work should include:
moving from x-cache header to the standard cache-status header
removing the UA match for IE <8 's inconsistency with XML-HTTP-Request
Previously a cache miss would be cached twice - an unversioned entry + a versioned entry for the same cache key. This would allow cases where the versioned entry was not strictly needed and shouldn't cause a cache miss (eg: bot traffic). However, this doubling of the cache entries reduces the effective memory footprint and requires multiple round trips to the backing cache.
This PR collapses the cache to a single key and uses the entity-tag (
etag
) value for the situations when a strict cache value needs to be evaluated. This reduces the number of queries to the cache while preserving the intended semantics of the cache.Additionally, we move the a limited header set into the cache. Header caching is required for response metadata caching and will support other use cases such as the use of
cache-tags
and othercache-control
header values.Other changes in this pr:
cache_key
--> is for the lookup,entity_tag
is for the version)x-alternate-cache-key
Future work should include:
x-cache
header to the standardcache-status
header