Skip to content

How-to Guides

Technical References

Caching /

The VIP Cache Personalization API

The VIP Cache Personalization API provides an easy way to customize the caching behavior of the VIP CDN, allowing personalization and segmentation of your audience without sacrificing stability and performance. The VIP CDN is a global network of servers owned and managed by VIP, and amongst other services, it provides caching for the VIP Platform.

What is Cache Personalization?

Web development is often about balances and compromises. 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 is great for ensuring 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 fantastic performance but comes with the challenge of requests potentially displaying outdated content until it is regenerated manually or automatically

The VIP Platform has been designed to handle both. However, to achieve the high levels of scaling and performance that many applications expect, caching is essential. By serving the same cached content to as many users as possible, we can deliver on the promise of a platform that scales with your needs.

The default VIP CDN configuration works for most cases, but is insufficient when more control of the caching behavior is required (for example, serving different content to different groups of users). The VIP Cache Personalization API can help with that. It provides an easy way to customize the caching behavior of the VIP CDN while still leveraging the power and scale that it provides.

When should you use it?

Some common uses for the VIP Cache Personalization API include:

  • Tailoring content to the user’s location
  • 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

How does it work?

We provide a variety of ways to segment your content at the edge, serving different audience segments different content from different “cache buckets”. This is achieved through the Cache Personalization API. The API includes three implementations that can be taken depending on use case:

Audience Segmentation

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

For example, if we were introducing new Beta features for our site and wanted to allow users to opt-in to those features, we would 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 assign themselves to change the segments they have been assigned to. Typical use cases for this are paywalls, authenticated content, and any 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; get in touch if you’d like to learn more or get started using this feature.

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’d be happy to help validate and verify your use cases before you implement them; please reach out if that’s of interest.

How do you use it?

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

If you have have any questions about the API or how to make it work with of one of your use cases, please get in touch and we’d be happy to help.

Last updated: November 23, 2020