Set_Transient to end at midnight

Do you just want this lines ? $midnight_time = strtotime(‘tomorrow’) – time(); set_transient( ‘transient_name’, $transient_datas, $midnight_time); $midnight_time represent the seconds before midnight happens. You can ask your server to curl a page with a random parameter if you have cache to be sure your transient is consumed with a cronjob.

Difference between get_site_transient() and get_transient()

get_site_transient() uses the older nomenclature for multisite which referred to a multisite network as a “site” and individual sites on the network as “blogs”. So get_site_transient() is getting the value of a transient for the whole network, while get_transient() gets a transient for an individual site/blog. If you look at the source of the function … Read more

Synchronize Data every minute with set_transient

To my understanding, *_transient() is basically *_option() wrapped in a cache-timer. What that means in this context, is that set_transient( ‘…’, true, * MINUTE_IN_SECONDS ); will not run/re-evaluate every minute. Instead it will run/re-evaluate when the page has loaded by a visitor/user, and the data therein is older than 60 seconds. This is not ideal … Read more

How many transients is too many transients

It depends if you add an expiration time. If you do not add an expiration time then autoload will be yes. This means the option that stores this transient will be loaded on every request even if it’s not used. With large numbers of transients this poses an issue purely in terms of memory. I … Read more

Why Transients may not work correctly?

By the definition and the usage pattern, transients might be deleted at any point in time, the expiry time parameter really specifies only the maximal time the value will be cached. It might be that the particular site has a problem with transients not being cleaned on time and employs some code to clean them … Read more

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