How splitting the cache by group with x-0-device header

We have following code:

CustomCacheKey()
  .addHeader(HTTP_HEADERS.x0Device, header => {
    header.group('mobile').byPattern(/^(smartphone|mobile)$/);
    header.group('desktop').byPattern(/^(tablet|desktop)$/);
  })

The idea is to divide cache into 2 groups:
1 - desktop and tablet
2 - mobile

But after deployment to actual environment we noticed that there are 4 different caches for each type of devices.
Please explain how can we split the cache by group with x-0-device header?
we need to get same cache on tablet and desktop and another one for mobile devices

Please note: following topic doesn’t have resolution for our question How can can I split my cache by device type (such as desktop vs. mobile)?

1 Like