transient or not transient

Transients are a simple way of storing cached data in the database temporarily by giving it a custom name and a timeframe after which it will expire and be deleted. So yes, it will be a good idea to get data from second DB and store it as a transient. First thing you have to … Read more

Set Transient does nothing

And that exactly how it will work, because that’s what you coded 😉 You set the transient correctly, but… You put only query arguments in there. And that doesn’t make much sense – it’s just an PHP array that is very easy and quick to create. And the query itself is executed always – it’s … Read more

Is this the proper usage of creating / using a transient?

No quite: Get the transient’s content first, then do the expensive work to fetch the external resource. function google_transient() { $transient_name=”google”; $content = get_transient( $transient_name ); // done if ( $content ) return $content; $url=”http://www.google.com”; $content = wp_remote_retrieve_body( wp_remote_get($url) ); set_transient( $transient_name, $content, DAY_IN_SECONDS ); // 24 hour cache return $content; }

Transient unique names

Transients have practical limitation on key length (45 symbols or something like that), so using dynamic keys tends to come with risk of ending up with keys too long and having it break down. One of common practices is to form unique string (for example combination of plugin name and type of data being saved, … Read more

Can set_transient() be used in multi-site?

As the Codex suggests: Essentially the same as set_transient() but works network wide when using WP Multisite. One difference is that the transient name should be 40 characters or less in length. Also, while set_transient() sets transients that have an expiration time to not autoload, all transients added with set_site_transient will auto-load at all times. … Read more

Clearing cached plugin data if it is using an external object cache

We note that the Transients API uses the Object Cache API, when we use an object-cache.php drop-in file. For example if wp_using_ext_object_cache() returns true, then get_transient( $transient ) -> wp_cache_get( $transient, ‘transient’ ) set_transient( $transient, $value, $expiration ) -> wp_cache_set( $transient, $value, ‘transient’, $expiration ) delete_transient( $transient ) -> wp_cache_delete( $transient, ‘transient’ ) where the … Read more

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