You must be new to After Effects. Ram preview length depends on system resources, composition size, preview resolution and frame rate. The way most AE artists work on HD comps is to have the Magnification factor of the composition panel set to 50% and the Comp Panel resolution set to Auto. Until you develop a good understanding of video standards and formats it is important that your composition settings never say "Custom" and that you always work in square pixel formats. On a typical system with 8GB of ram you may see 7 to 10 seconds of Ram Preview on a comp that is standard 1080 HD and 29.97 fps at 50% Magnification Factor resolution set to Auto. If your system is very clean you may see 10 to 15 seconds with those settings.
This brings up another point. Many newbies start right off editing movies in After Effects that are two or three or even 10 minutes long. Well, sad to say, that's not ever a good idea. After Effects is a program specifically suited to creating Visual Effects shots that cannot be created in a Non Linear Editor like Premiere Pro or Final Cut. My typical comps are one shot and usually 7 seconds or less because most movie projects I work on don't have very many cuts that are longer than 7 seconds. I'm working on a fight scene for a western right now and several of my comps are less than 2 seconds because you only want to work on the frames that are actually going to end up in the movie.
I would strongly suggest that you take a couple of hours and study up on the User Interface and the typical workflow for After Effects. There are about 10,000 switches you can throw in AE so you'll have to go through some training material to keep from getting completely lost. I would suggest you start here: Basic AE
I've been using AE since CS5.
My issue isn't with RAM preview, it's that the playback loops back whatever it has previewed, sometimes as little as half a second. No version of AE I've used prior to CC 2017 does that.
Did you follow Rick's advice for preview? How did that work for you? Please let us know if that worked for you or if you still need help.
Had same problem and even togling these loop and unloop it keept doing it. Restarted my laptop and worked fine but it really makes you waste time trying to figure out how to solve it.