A great deal of interest has been recently directed at exploring how the performance of photovoltaic and thermophotovoltaic systems can benefit from the use of ultra-thin layers and near-field effects. Related questions on how radiation transfer is modified if both the source and sink of the radiation are located within an optical cavity have, however, received far less attention. This question is, nevertheless, particularly relevant in the field of electroluminescence-driven thermophotonics, which could substantially benefit from the possibility to boost the energy transfer by making use of optical cavities. To gain insight into this possibility, we deploy fluctuational electrodynamics and study the fundamental resonance effects in structures where the emitter and absorber layers are separated by a vacuum nanogap and bordered by high-efficiency mirrors. We obtain the expected result that resonance effects can strongly enhance the interactions at specific wavelengths and propagation angles. Moreover, we find that even after integrating over wavelength and propagation angle, (1) the total power emitted can be tuned by adjusting the cavity thickness and the optical cavity mode structure, and (2) thinning the active layer enhances its emission in the cavity, causing a sublinear dependence between the active layer thickness and its overall emission. In plain numbers, adjusting the cavity thickness produces non-monotonous changes of over 50% in the total emission of thin layers. These observations apply also to absorption, which can become remarkably efficient even for an extremely thin absorber layer, thanks to cavity effects.