It is overkill for the original question to trigger all the filesystem oriented flushes (via sync, for which issuing it once should be fully sufficient, and echoing 3 to drop_caches).
To flush the page cache (“memory” / RAM) only, execute
echo 1 > /proc/sys/vm/drop_caches