SharedTempStoreFactory and PrivateTempStoreFactory $expire variable should be changeable for each collection

Created on 2 June 2017, over 7 years ago
Updated 1 January 2024, 11 months ago

Problem/Motivation

Right now, the $expire variable in PrivateTempStore.php isn't exposed anywhere, except as a parameter in user.services.yml. This gives developers the ability to override the default expiration on private tempstore collections, but it's still a one-size-fits-all value for all collections that are created.

However, there are many cases where one might want different tempstores to have different $expire values. For example, I'm using a private tempstore in a custom module to hold a list of external HTTP_REFERER values for each user who visits the site via an external link. Then, when a user fills out the contact form, those values are submitted via a hidden field so we can track our conversion rates from different sources. Naturally, we want that collection to last several months at least, since a user might find the site via an ad, but not fill out the contact form for some time afterward.

The same site might also use a private tempstore for a multi-step form, in which case it might be useful for the tempstore to only last a few hours. And so on.

What I'd really like to see is a public function setExpire($expire) in PrivateTempStore.php that lets developers manually set the expire value on a per-collection basis in their custom modules. Or perhaps an $expire argument with a default value added to the get() function that's already there.

Steps to reproduce

NA

Proposed resolution

TBD - what was the ultimate solution

Remaining tasks

Update issue summary

User interface changes

NA

API changes

TBD

Data model changes

TBD

Release notes snippet

TBD

Feature request
Status

Needs work

Version

11.0 🔥

Component
Base 

Last updated about 1 hour ago

Created by

🇺🇸United States hor8tio

Live updates comments and jobs are added and updated live.
  • Needs manual testing

    The change/bugfix cannot be fully demonstrated by automated testing, and thus requires manual testing in a variety of environments.

  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024