private void setCacheHeaders(RestRequest restRequest, RestResponseChannel restResponseChannel)
      throws RestServiceException {
    Container container = RestUtils.getContainerFromArgs(restRequest.getArgs());
    if (container.isCacheable()) {
      long cacheTtl = container.getCacheTtlInSecond() != null ? container.getCacheTtlInSecond().longValue()
          : frontendConfig.cacheValiditySeconds;
      restResponseChannel.setHeader(RestUtils.Headers.EXPIRES,
          new Date(System.currentTimeMillis() + cacheTtl * Time.MsPerSec));
      restResponseChannel.setHeader(RestUtils.Headers.CACHE_CONTROL, "max-age=" + cacheTtl);
    } else {
      restResponseChannel.setHeader(RestUtils.Headers.EXPIRES, restResponseChannel.getHeader(RestUtils.Headers.DATE));
      restResponseChannel.setHeader(RestUtils.Headers.CACHE_CONTROL, "private, no-cache, no-store, proxy-revalidate");
      restResponseChannel.setHeader(RestUtils.Headers.PRAGMA, "no-cache");
    }
  }
Sets headers that provide directions to proxies and caches.
@param restRequest the {@link RestRequest} that was received.
@param restResponseChannel the channel that the response will be sent over
@throws RestServiceException if there is any problem setting the headers
ambry-frontend/src/main/java/com/github/ambry/frontend/AmbrySecurityService.java