Think about what happens when the same data is requested multiple times.
Object caching saves query results so WordPress doesn't ask the database repeatedly, which speeds up page loading.
Think about what happens when the server doesn't have to build the page from scratch.
Page caching stores the full page HTML so the server can quickly send it without running PHP or database queries, making pages load faster.
The expiration time is in seconds. 1 hour = 3600 seconds.
The third parameter is expiration in seconds. 60*60 equals 3600 seconds (1 hour). Option A uses the correct value and data type.
set_transient('cache_key', 'value', 0);
What is the reason the transient never expires?
set_transient('cache_key', 'value', 0);
Check what the expiration parameter means when set to zero.
In WordPress, an expiration time of 0 means the transient will never expire automatically.
wp_cache_set('key', 'first');
$value1 = wp_cache_get('key');
wp_cache_set('key', 'second');
$value2 = wp_cache_get('key');
What are the values of $value1 and $value2?wp_cache_set('key', 'first'); $value1 = wp_cache_get('key'); wp_cache_set('key', 'second'); $value2 = wp_cache_get('key');
Think about what happens when you set and get cache values in order.
The first set stores 'first'. Getting it returns 'first'. Then setting 'second' overwrites the key. Getting again returns 'second'.