[wp-trac] [WordPress Trac] #55969: The function set_transient should have the autoload argument

WordPress Trac noreply at wordpress.org
Mon Jun 13 04:41:57 UTC 2022


#55969: The function set_transient should have the autoload argument
-------------------------+------------------------------
 Reporter:  giuse        |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Database     |     Version:  6.0
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:  performance
-------------------------+------------------------------

Comment (by galbaras):

 [https://developer.wordpress.org/reference/functions/set_transient/ The
 set_transient() manual] states:

 > NB: transients that never expire are autoloaded, whereas transients with
 an expiration time are not autoloaded. Consider this when adding
 transients that may not be needed on every page, and thus do not need to
 be autoloaded, impacting page performance.

 This seems to make sense. Temporary values should definitely not be
 autoloaded, but permanent ones can help save some time by being
 autoloaded.

 I've just checked one of my sites and it has 14 autoloaded transients vs.
 138 that aren't autoloaded.

 You can find out about your own site using the following SQL query:

 `SELECT autoload, count(*) FROM wp_options WHERE option_name LIKE
 '_transient_%' group by autoload`

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/55969#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list