PrivateTempStore deprecated
class PrivateTempStore extends PrivateTempStore (View source)
deprecated
Stores and retrieves temporary data for a given owner.
Traits
Provides dependency injection friendly methods for serialization.
Properties
| protected array | $_serviceIds | An array of service IDs keyed by property name used for serialization. |
from DependencySerializationTrait |
| protected array | $_entityStorages | An array of entity type IDs keyed by the property name of their storages. |
from DependencySerializationTrait |
| protected KeyValueStoreExpirableInterface | $storage | The key/value storage object used for this data. |
from PrivateTempStore |
| protected LockBackendInterface | $lockBackend | The lock object used for this data. |
from PrivateTempStore |
| protected AccountProxyInterface | $currentUser | The current user. |
from PrivateTempStore |
| protected RequestStack | $requestStack | The request stack. |
from PrivateTempStore |
| protected int | $expire | The time to live for items in seconds. |
from PrivateTempStore |
Methods
Constructs a new object for accessing data from a key/value store.
Retrieves a value from this PrivateTempStore for a given key.
Stores a particular key/value pair in this PrivateTempStore.
Returns the metadata associated with a particular key/value pair.
Deletes data from the store for a given key and releases the lock on it.
Gets the current owner based on the current user or the session ID.
Details
__sleep()
{@inheritdoc}
__wakeup()
{@inheritdoc}
__construct(KeyValueStoreExpirableInterface $storage, LockBackendInterface $lock_backend, AccountProxyInterface $current_user, RequestStack $request_stack, int $expire = 604800)
Constructs a new object for accessing data from a key/value store.
mixed
get(string $key)
Retrieves a value from this PrivateTempStore for a given key.
set(string $key, mixed $value)
Stores a particular key/value pair in this PrivateTempStore.
Lock|null
getMetadata(string $key)
Returns the metadata associated with a particular key/value pair.
bool
delete(string $key)
Deletes data from the store for a given key and releases the lock on it.
protected string
createkey(string $key)
Ensures that the key is unique for a user.
protected string
getOwner()
Gets the current owner based on the current user or the session ID.
protected
startSession()
Start session because it is required for a private temp store.
Ensures that an anonymous user has a session created for them, as otherwise subsequent page loads will not be able to retrieve their tempstore data.