You are here

public function SessionBasedTempStore::__construct in Session Based Temporary Storage 8

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.

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

\Drupal\Core\Session\SessionConfigurationInterface $session_configuration: The session configuration interface.

string $cookie_name: The name of a cookie which will hold the storage ID.

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

string $path: The path on the server in which the cookie will be available on. If set to '/', the cookie will be available within the entire domain. If set to '/foo/', the cookie will only be available within the /foo/ directory and all sub-directories such as /foo/bar/ of domain. By default the value is to '/'.

File

src/SessionBasedTempStore.php, line 105

Class

SessionBasedTempStore
Stores and retrieves temporary data for a given owner.

Namespace

Drupal\session_based_temp_store

Code

public function __construct(KeyValueStoreExpirableInterface $storage, LockBackendInterface $lock_backend, RequestStack $request_stack, SessionConfigurationInterface $session_configuration, string $cookie_name, $expire = 604800, $path = '/') {
  $this->storage = $storage;
  $this->lockBackend = $lock_backend;
  $this->requestStack = $request_stack;
  $this->sessionConfiguration = $session_configuration;
  $this->cookieName = $cookie_name;
  $this->expire = $expire;
  $this->path = $path;
}