1

Both the tempstore.private and tempstore.shared services store data which have an associated owner; for logged-in users, that is the user ID.

When an account is deleted, are the data having that user ID as owner removed?

I looked at User::postDelete(), but there isn't code for that.

public static function postDelete(EntityStorageInterface $storage, array $entities) {
  parent::postDelete($storage, $entities);
  $uids = array_keys($entities);
  \Drupal::service('user.data')
    ->delete(NULL, $uids);
}

It could be I didn't look at the correct class, or the code to delete those data is still missing from Drupal core.

Should I expect the data stored with the tempstore.private and tempstore.shared services be immediately deleted after a user account is deleted?

1 Answer 1

1

The user's temp storage deletion isn't attached to the user deletion process.

If you look at the class, PrivateTempStoreFactory, instantiated for tempstore.private & tempstore.shared, you can see that the class has an expire property that determines the storage's TTL (in seconds).

These services are instantiated with an expire value of defined by parameters:tempstore.expire in core.services.yml, with a default of 604800 seconds (1 week), so the temp storage will expire 1 week after its creation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.