[wp-trac] [WordPress Trac] #61296: Add "force" parameter to get_option and get_transient
WordPress Trac
noreply at wordpress.org
Sat May 25 11:49:16 UTC 2024
#61296: Add "force" parameter to get_option and get_transient
--------------------------------+-----------------------------
Reporter: juvodesign | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Options, Meta APIs | Version:
Severity: normal | Keywords:
Focuses: |
--------------------------------+-----------------------------
Since both get_transient and get_option already have built in ways to
handle object caching, i think it would be reasonable to add the force
parameter and pass it through to wp_cache_get.
I imagine having the default parameter set to false. This shouldn't break
anything but give developers better control in cases where the cache is
being updated while in a request lifecycle.
I stumbled across this when using persistent object caching:
https://github.com/rhubarbgroup/redis-cache/issues/523
Other users are also missing this option:
https://wordpress.stackexchange.com/questions/100040/can-i-force-get-
option-to-go-back-to-the-db-instead-of-cache
If this is something worth considering, I would happily provide a patch.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61296>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list