Skip to content

Backgrounds

How-to Guides

Technical References

Caching /

The VIP Cache Personalization API

When it comes to serving dynamic content within a CMS, there are two ends of the spectrum:

  1. Generate each page every time a user request comes. This ensures the user always has the most up-to-date copy but comes with a performance penalty as the code and database calls run each time.
  2. Generate a page once and then cache the content for future requests. This option offers improved performance but requests potentially display outdated content until it is regenerated.

Caching is essential for achieving the high levels of scaling and performance that many applications expect. The default VIP CDN configuration works for most cases, but is insufficient when more control of the caching behavior is required (e.g., serving different content to different groups of users). The VIP Cache Personalization API can help with that. It provides a way to customize the caching behavior of the VIP CDN while still leveraging the power and scale that it provides.

Some common uses for the VIP Cache Personalization API include:

  • Tailoring content to the user’s location (geotargeting)
  • Displaying different website features to a select group (e.g. Beta site)
  • A/B testing
  • Gating content until users opt-in (e.g. Accepting Terms and Conditions)
  • Content paywalls
  • Membership sites using custom authentication systems
  • 3rd party integrations that require uncached content/resources

Implementing the Cache Personalization API

The Cache Personalization API includes three implementations that can be taken depending on use case: audience segmentation, encrypted audience segmentation, and bypass.

Audience segmentation

This is useful when you want to serve different cached content to different constituencies in your audience. The API allows you to create a new cache group and assign users to specific segments within that group.

For example, if you are introducing new Beta features for our site and want to allow users to opt-in to those features, you could create a new group called “beta” with two user segments within that: users that have opted into the beta and users that have not.

You can define as many groups as you want and users can belong to multiple groups and segments as well. It’s important to note that the higher the number of groups, the higher the variance in caching responses, which can result in decreased cache efficacy and performance. As such, the API should be used with care.

At a technical level, when a user is assigned to an audience segment, the API sets a cookie defining the group or groups the user is part of.

Encrypted audience segmentation

Encrypted audience segmentation is similar to audience segmentation, but ensures that it is not possible for even for a very savvy technical user to change the segments they have been assigned to. Typical use cases for this are paywalls, authenticated content, and other situations where you want to cache content based on encrypted credentials not visible to the user.

At a technical level, the cookie defining the group or groups the user is part of contains an encrypted string which cannot be read or altered by the user without scrambling the content.

Please note that encrypted audience segmentation requires activation by the VIP team.

Cache bypass

This gives you the ability to turn off all caching for a given visitor. This is useful for 3rd party services that consume data or content from your application and require uncached data. It’s also applicable when working with external authentication system. Learn more about the implementation.

Please note that disabling caching can have detrimental effects on the performance of your site.

We’ve put together some useful tutorials and examples that walk through how to implement various uses cases using the API.

Last updated: April 09, 2021