"Twenty Years a Dream" is believed to be one of the earlier entries Pu wrote for Strange Tales from a Chinese Studio (Liaozhai). As Allan Barr observes in his Comparative Studies of Early and Late Tales in Liaozhai Zhiyi, "earlier stories tend to focus more on love and sex and later stories on social satire." The overarching message of the story is an inversion of the oft-repeated adage "life is but a dream"; rather than sticking to convention, Pu writes of death being like a dream, "replete with all the elegaic associations of dream as a metaphor for a vanished past." Pu also makes a handful of cultural references, including to Yang Guifei breasts ("lotus kernels") and Yuan Zhen ballad The Lianchang Palace ().
