How can can I split my cache by device type (such as desktop vs. mobile)?

I want to serve up different version of the site depending on which type of device is accessing the site. I’m specifically trying to serve up two versions of the same pages for the following

  • Mobile
  • Desktop

To that end, how can I split my cache based on the device type?

You can create a custom cache key with the addDevice() function as described here.

The end result will be that the XDN will split the cache into the following buckets that you can read from the request header x-xdn-device

  • smartphone
  • tablet
  • mobile (feature phones)
  • desktop

this header is generated from the user agent header and will appear on your server logs

See here for more information.