wp-cron.php – How are WP’s Cron transients removed?

Transients expire on their own. No need to unset them. And to call wp-cron manually is simple. Just define DISABLE_WP_CRON to true in the wp-config file to disable the normal cron spawning process. Then make your cron system hit wp-cron.php manually every so often to process pending jobs. There is no other special trick that … Read more

Get a list of existing transients

The db query would look like this: SELECT `option_name` AS `name`, `option_value` AS `value` FROM $wpdb->options WHERE `option_name` LIKE ‘%transient_%’ ORDER BY `option_name` To sort the results by their function (site transients, timeouts) use a function like this: add_action( ‘shutdown’, function(){ global $wpdb; $sql = “SELECT `option_name` AS `name`, `option_value` AS `value` FROM $wpdb->options WHERE … Read more

Using transients in conjunction with memcached

When and how to use transients or the object cache is a bit tricky and site-dependent. Here’s the breakdown: When not using a persistent object cache (like memcached): Transients are stored in the database Objects in the object cache are only cached for the duration of the page request. When using a persistent object cache … Read more

Why are transients cleared prematurely?

TL;DR WordPress part of transient handling is solid, everything is pretty precise Transients use object cache instead of data store for non-default implementations It means that some back-end cache systems get rid of cache that hasn’t been accessed recently Bottom line: it’s not WordPress fault, it only depends on how your back-end cache is set … Read more

Are transients private or public?

Transients are just database keys that expire. It’s like telling WordPress you want it to remember a certain piece of information, but for a limited time. In general, transients are accessible to PHP through any request. But since they’re server-side, transients are only exposed to front-end users if you as the developer expose them. A … Read more