[wp-trac] [WordPress Trac] #43112: set_transient uses object-cache as storage instead of cache layer
WordPress Trac
noreply at wordpress.org
Wed Jan 17 20:05:58 UTC 2018
#43112: set_transient uses object-cache as storage instead of cache layer
-------------------------+------------------------------
Reporter: batooo | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Cache API | Version: 4.9.1
Severity: normal | Resolution:
Keywords: | Focuses:
-------------------------+------------------------------
Comment (by dimadin):
If you want to have “persistent” transients, than there are libraries that
you can use to save temporary data in database instead of in object cache.
For example, my own [https://github.com/dimadin/wp-temporary
WP_Temporary], or newly released [https://github.com/10up/Async-Transients
Async Transients].
In case of `WP_Temporary`, you would use `WP_Temporary::set( $transient,
$value, $expiration );` instead of `set_transient( $transient, $value,
$expiration );`. Advantage here is that even if object cache is purged for
whatever reason, your data is still available from database until it
expires. Disadvantage is that you can use that only in your own code for
your own caches, other transients will still be saved in object cache
only. You can code workaround to force that data in database too, but I am
not sure will it degrade performance for some cases.
> Using APCu as an object-cache which is a PHP in-process storage leads to
high CPU and very slow loading time.
I am not sure what you want to say with this, but note that when you turn
on object caching, many other data is stored there, not just transients,
post objects, taxonomy terms, comments, users, queries etc.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43112#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list