You are here

public function PrivateTempStore::__construct in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/TempStore/PrivateTempStore.php \Drupal\Core\TempStore\PrivateTempStore::__construct()

Constructs a new object for accessing data from a key/value store.

Parameters

\Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface $storage: The key/value storage object used for this data. Each storage object represents a particular collection of data and will contain any number of key/value pairs.

\Drupal\Core\Lock\LockBackendInterface $lock_backend: The lock object used for this data.

\Drupal\Core\Session\AccountProxyInterface $current_user: The current user account.

\Symfony\Component\HttpFoundation\RequestStack $request_stack: The request stack.

int $expire: The time to live for items, in seconds.

File

core/lib/Drupal/Core/TempStore/PrivateTempStore.php, line 87

Class

PrivateTempStore
Stores and retrieves temporary data for a given owner.

Namespace

Drupal\Core\TempStore

Code

public function __construct(KeyValueStoreExpirableInterface $storage, LockBackendInterface $lock_backend, AccountProxyInterface $current_user, RequestStack $request_stack, $expire = 604800) {
  $this->storage = $storage;
  $this->lockBackend = $lock_backend;
  $this->currentUser = $current_user;
  $this->requestStack = $request_stack;
  $this->expire = $expire;
}