Call Caching

In effort to reduce latency and strain on your application server Mashery's Enterprise or Premium customers can choose from several caching options.  The offerings are as follows:

  • Global Caching
  • HTTP Cache-Control Headers
  • Surrogate Cache-Control
  • Custom Caching Adapter

Global Caching

The first level of caching is Global Caching.  A global TTL is set for all calls in an entire service.  A hash is created based on the URL plus paramters (API Key is removed from the cached call).  Calls with a Cache-Hit within the designated TTL are returned from cache, bypassing the application server.  If a call is a Cache-Miss, the response is stored in cache and TTL set.  

HTTP Cache-Control Headers

For a finer grained control of the cache HTTP Cache-Control Headers can be enabled.  We enable a Global TTL default as above, but by setting the Cache-Control header in your responses you can override the global TTL and set the TTL on an object by object basis. We then calculate the amount of time left on the TTL and pass that back to the developer.

We only deal with the max-age and no-store directives and fall back to the Expires header if the cache-control header is not present.

For more information, please check out the RFC: http://tools.ietf.org/html/rfc2616#section-14.9

Surrogate Cache-Control

Similar to HTTP Header Cache-Control, Surrogate Cache-Control will allow you to control TTL on an object by object basis.  The primary difference between cache-control headers and Surrogate Cache-Control is that the information about the TTL and cache is not updated by the proxy but rather passed on as-is to the developer.

Custom Caching Schemes

With each of the above, Mashery can configure custom caching schemes with variable TTLs based on certain parts of the URL or parameters. 

Docs Navigation