12. get_option()
Is it in $all_options?
Yes
No
Is it in $wp_cache?
Return value.
Yes
No
Is it in the database?
Yes
No
Add to $wp_cache
Return $default.
13. get_option()
Is it in $notoptions?
Yes
No
Is it in $all_options?
Yes
No
Is it in $wp_cache?
Return value.
Yes
No
Is it in the database?
Yes
No
Add to $wp_cache
Add to $notopions
Return $default.
20. function set_transient( $transient, $value, $expiration = 0 ) {
// Check for external object cache and use it.
// Check DB for existing value and update expiration.
// Add an option with the expiration of this transient.
// Add the transient value to the DB.
}
21. function get_my_data() {
$data = get_transient( 'my_data' );
if ( false === $data ) {
$data = $wpdb->get_results( $query );
set_transient( 'my_data', $data, DAY_IN_SECONDS );
}
!
// Do something with $data.
!
}
return $data;
22. function get_my_data() {
$data = wp_cache_get( 'my_data', 'my_group' );
if ( false === $data ) {
$data = $wpdb->get_results( $query );
wp_cache_set( 'my_data', $data, 'my_group', DAY_IN_SECONDS );
}
!
// Do something with $data.
!
}
return $data;
35. User Settings
Primary examples are the expansion/collapse of the admin menu, and
switching between text and visual. These can happen without a form
submit, and you wouldn't want to fire an XHR request every time just to
save the previous state.
—Andrew Nacin