Is caching in spark a transformation or an action?

Is caching in spark a transformation or an action?

Though cache() or persist() is just another function on RDD which marks RDD to be cached or persisted. The first time an RDD is evaluated as a consequence of an action, it will be persisted/cached.

So, cache() or persist() is neither an action nor a transformation.