One – purge everything under the edit menu
Two – set the zoom or magnification factor in the comp pame to 50%
Three – set the composition panel resolution to auto
Four – run your preview, it should be longer
If that fails we need details on the composition size, frame rate, and the assets used in your timeline. The length of the ram preview you get depend entirely on the assets in your computer and the size and resolution that you were trying to preview. After effects does not process video in the same way that a NLE (Non-linear editor) does so for now the length of your real time preview is limited.
90% of my AE compositions are seven seconds or less because I hardly ever try to edit in After Effects. It was never designed to do that, nor is any other compositing app. You also can't learn very quickly that the most efficient way to work is to preview the animation early on and get the motion set up what do you like it before you start adding any other effects. I call it working in the pencil test – ink and paint – print process. It is very rare for me to run a ram preview at full resolution before I send a project to rendering. I do check a few frames here snd there at fullscreen in full resolution but I can't get anything done get a reasonable time if I'm sitting around waiting for ram previews. Once you get a little experience you will find that most of your rendeed work out just fine and the time you would've spent fiddling around with ram previews will help you complete several more shots in a day.