Content Application Developer Manual / Version 2307
Table Of ContentsHTTP Caching improves the website performance by instructing CDNs and clients to reuse previously fetched resources. The Cache-Control HTTP header offers fine-grained instructions for CDNs and HTTP clients on how to cache. Websites and eCommerce integrations always need to balance between efficiency and accuracy. With the CoreMedia Cache Control API and default implementation, projects have full control over caching behavior of content delivered by CoreMedia Content Cloud.
HTTP Cache-Control headers generated by the CAE can be configured very precisely. See Section 3.1.3, “Http Cache Control Properties” in Deployment Manual for all configuration options.
Additionally, the Cache-Control header's max-age
directive is computed taking
the content validity settings (validFrom/validTo
) into account
so that the response expires at the next scheduled content change date.
These validity-based calculation works by recording and caching of validity data during rendering.
Thus, for the first request towards a URL a default, short max-age
for the content type is used.
During rendering the validity information is recorded for all content beans that are involved.
For the next request, the recorded, more accurate validity-based expiration date is available and used for a more
precise max-age
value.
By adapting the configuration or implementing custom code, projects can also tune Cache-Control headers according
to their needs. If the function of the provided DefaultCacheControlStrategy
does not fit
your needs it is also possible to implement your own CacheControlStrategy
.
Note
If your CAE extensions already add the HTTP Cache-Control header for some resources to the responses, the CoreMedia Cache-Control component would not overwrite these values. If you want to use the CoreMedia Cache-Control component, make sure your customization do not handle Cache-Control header itself.
You can configure Cache-Control defaults for certain object types or for URL pattern. Object type specific configuration and URL pattern based configuration can be used side by side.
If both URL based and type based configuration match, URL pattern based configuration takes precedence over type based configuration.
The configuration options include those defined by
Cachecontrol.
The most important property in this context is the max-age
property.