spark.worker.hasPersisted
function hasPersisted(key: string): booleanCheck if a value is already persisted.
Useful for conditional initialization or testing whether a value survived a hot reload.
Parameters
keystring- Persisted value identifier
Returns
boolean– True if the value exists in persistent storageExamples
if (spark.hasPersisted('model')) {
console.log('Model survived hot reload');
} else {
console.log('Model was recreated');
}See Also
- persist - Persist a value