Content Application Developer Manual / Version 2101
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 or calculated very precisely. See the class CacheControlConfigurationProperties and Section 4.1.3, “Http Cache Control Properties” in Deployment Manual for all configuration options.
Additionally, these cache default TTLs are optionally overridden by content validity settings (validFrom/validTo) so that caching only occurs until the next scheduled content change. 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 TTL 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 cache TTL.
By adapting the configuration or implementing custom code, projects can also tune Cache-Control headers according
to their needs. If the function ot 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.