Reset Transient on New Day

There is no reliable way to achieve what you want with the Transients API – or even, if you have been considering it, with the WP Cron system. The problem is in a nutshell: Those API systems depend on user input. If you want to know more about it, do a research, as this has … Read more

Is priming a Transient Cache possible?

Your issue is not as much priming (which only happens first time) but that cache refreshes in solution you are using are synchronous. Transients API is not dealing with updates by itself, it is handled by code that calls it. So it doesn’t implement async updates. On other hand there is nothing that prevents implementing … Read more

Integrating WP-TLC-Transients with WordPress – Where to Begin?

Place wherever your code can access Include tlc-transients.php during your plugin/theme load (or otherwise before init hook) Follow examples from readme for library’s API use PS in [still not very common] case you are using Composer you can also just require markjaquith/wp-tlc-transients in composer.json.

How to save new transients if query changes?

According to code in OP, the only thing that changes the result is the $tags variable. In this case, the easiste way to do the trick is make the $tags part of the transient name. function get_posts_by_tags($tags){ $transient=”rest-posts-” . md5(serialize($tags)); if(false === ($result = get_transient($transient))) { // the rest of yout function here … if … 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

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

Is there any danger in deleting all transients?

For development I would advise to always work with WP_DEBUG set to true and do the following: $key = ‘transient_key’; if( !WP_DEBUG && ( false !== ($transient = get_transient($key)) ){ /* Generate transient manually */ $expiration = 24*60*60;//How long to keep for set_transient($key,$transient, $expiration); } In general – it should be fine deleting transients, as … Read more

Cache remote (HTTP) request with Transients API

Catching the weather API remote data The msg, you’re showing in your question is basically the result from the weather API. And it says, that there’s no data available for your location. The first thing you want to do is some research in the Codex and the “WP HTTP API”. The right/WP way to grab … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)