Full page redis cache mobile pages separately

Something that the w3tc plugin allows is a way to cache pages separately based on user agent groups. I know this is bad practice anyway, but I have a photo gallery plugin I love that uses php to detect desktop vs mobile. It doesn’t work correctly because the pages are cached based on whatever device hit them first. Would there be any way to cache a separate version of a page based on a list of user agent strings?