Is there a way to check if transient exists before retrieving the whole saved data?
According to this page, http://codex.wordpress.org/Transients_API, to check whether the saved transient value is successfully retrieved, the following code is used:
if ( false === ( $value = get_transient( 'value' ) ) ) {
// this code runs when there is no valid transient set
}
But this is assumed that the retrieved data will be used if available. When hundreds of web pages are cached with the Transient API and need to be only checked if the cache is still there, it’s not practical to retrieve all the data. I’m not sure how it affects the speed and memory but in general, the larger the size is, it gets slower and consumes more memories.
So I’m wondering if there is a simple way to only check if it is saved or not like the empty() function.
Thanks for your information.
This only retrieves the expiration time.