[wp-trac] [WordPress Trac] #55969: The function set_transient should have the autoload argument
WordPress Trac
noreply at wordpress.org
Sun Nov 26 10:33:01 UTC 2023
#55969: The function set_transient should have the autoload argument
--------------------------------+------------------------------
Reporter: giuse | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Options, Meta APIs | Version: 6.0
Severity: normal | Resolution:
Keywords: needs-patch | Focuses: performance
--------------------------------+------------------------------
Comment (by oglekler):
I stumbled upon the same problem. I am getting some data from a third-
party API that is needed for all front-end pages. I need this data to be
valid, but I need to preserve it until the site does not get new data to
avoid issues. So, I added a transient without expiration time and wanted
to add another transient with expiration, but it turned out that it would
not be autoloaded and would require an additional request to the DB.
Finally, I decided to add a timestamp to the data I am receiving and save
it in the same transient, but it would have been simpler just to check the
second transient for existence.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/55969#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list