class PrivateTempStoreFactory (View source)

Creates a PrivateTempStore object for a given collection.

Properties

protected KeyValueExpirableFactoryInterface $storageFactory

The storage factory creating the backend to store the data.

protected LockBackendInterface $lockBackend

The lock object used for this data.

protected AccountProxyInterface $currentUser

The current user.

protected RequestStack $requestStack

The request stack.

protected int $expire

The time to live for items in seconds.

Methods

__construct(KeyValueExpirableFactoryInterface $storage_factory, LockBackendInterface $lock_backend, AccountProxyInterface $current_user, RequestStack $request_stack, int $expire = 604800)

Constructs a Drupal\Core\TempStore\PrivateTempStoreFactory object.

get(string $collection)

Creates a PrivateTempStore.

Details

__construct(KeyValueExpirableFactoryInterface $storage_factory, LockBackendInterface $lock_backend, AccountProxyInterface $current_user, RequestStack $request_stack, int $expire = 604800)

Constructs a Drupal\Core\TempStore\PrivateTempStoreFactory object.

Parameters

KeyValueExpirableFactoryInterface $storage_factory

The key/value store factory.

LockBackendInterface $lock_backend

The lock object used for this data.

AccountProxyInterface $current_user

The current account.

RequestStack $request_stack

The request stack.

int $expire

The time to live for items, in seconds.

PrivateTempStore get(string $collection)

Creates a PrivateTempStore.

Parameters

string $collection

The collection name to use for this key/value store. This is typically a shared namespace or module name, e.g. 'views', 'entity', etc.

Return Value

PrivateTempStore

An instance of the key/value store.