Note that

cache()
is now an alias for
persist(StorageLevel.MEMORY_AND_DISK)
according to the docs.