Cache

You can add cache rules from your Magnolia PaaS Cockpit. Caching reduces requests to Magnolia which helps reduce heavy processing loads and improves performance.

Expand the image here to see the different parts of adding a rule in the Cockpit and is applicable to both cache types.

Rule anatomy

cache rule anatomy

  1. Add a new rule. Once you click this, a new rule is added to the top of the list.

  2. Naming your rule.

  3. Choosing the cache type which is Never or a duration (in minutes).

  4. Add a voter.

  5. Save changes to your rules. This saves changes to Author.

  6. Publish rules to production. This saves changes to Public.

  7. Move rule up or down. Remember the first to match is accepted.

  8. Delete a rule.

Add Browser cache rule

browserCachePolicy is defined in Magnolia.

Rules

  • The rules apply from top to down.

  • The first rule matching the request defines which Cache-Control header will be applied to the response.

Instructions

To add a Browser cache rule:

  1. Go to your Cockpit.

  2. Go to Content delivery > Cache.

  3. Choose the Browser cache tab.

  4. Click Add a new rule.

    The new rule will appear at the top of the rule list where you can edit it.

    1. Give the rule a Name.

    2. Choose the Type.

      Table 1. options
      Type Description

      Never cache

      You guessed it. It’s never cached.

      Cache for

      Allows you to set the time something is cached for (in minutes).

    3. Choose When it happens using the AND or OR options.

    4. Click the symbol if you want to add any voters.

      1. Choose the condition you want and click Add.

        Each condition comes with a preset set of rules you can choose from.

        For example, URL starts with condition comes with an option of starts with or does not start with whereby you can add a pattern to fulfill that requirement.

    5. When you’re happy with your new rule, don’t forget to save you work by going to the top and clicking Save changes.

    6. To put your rules into production, you’ll also need to Publish your new rule.

Add CDN cache rule

It also helps serve cached content when Magnolia is down or having any issues.

Rules

  • The rules apply from top to down.

  • The first rule matching the request defines which Surrogate-Control header will be applied to the response.

    • The Surrogate-Control header takes precedence over the Cache-Control one.

    • Surrogate-Control headers are removed before a response is sent to an end user.

    • In the absence of the Surrogate-Control header, the CDN uses the Cache-Control header.

Instructions

To add a CDN cache rule:

  1. Go to your Cockpit.

  2. Go to Content delivery > Cache.

  3. Choose the CDN cache tab.

  4. Click Add a new rule.

    The new rule will appear at the top of the rule list where you can edit it.

    1. Give the rule a Name.

    2. Add a directive to the Surrogate Control field.

      What values can be added?
      • max-age: defines how long the response entity can be considered fresh in seconds before it considers the cached entity stale.

      • stale-while-revalidate: defines how long in seconds that the cache can reuse a stale response while it revalidates it to a cache.

      Example: max-age=86400, stale-while-revalidate=60

    3. Choose When it happens using the AND or OR options.

    4. Click the symbol if you want to add any voters.

      1. Choose the condition you want and click Add.

        Each condition comes with a preset set of rules you can choose from.

        For example, URL starts with condition comes with an option of starts with or does not start with whereby you can add a pattern to fulfill that requirement.

    5. When you’re happy with your new rule, don’t forget to save you work by going to the top and clicking Save changes.

    6. To put your rules into production, you’ll also need to Publish your new rule.

Feedback

PaaS

×

Location

This widget lets you know where you are on the docs site.

You are currently perusing through the Magnolia PaaS docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules