There are two methods to persist the data
1. persist() to persist permanently and
2. cache() to persist temporarily in the memory.
There are different storage level options available such as MEMORY_ONLY, MEMORY_AND_DISK, DISK_ONLY and many more. Both persist() and cache() uses different options depends on the task.
Hope this will answer your query to some extent.