Using cache functions with plugins or custom functions
-
I am writing some custom functions in my themes’ functions.php file.
In particular, I am looking to customize my archive display, so I intend to create my own query to get the results back directly.
In looking at wp_get_archives in general-template.php, I see the following cache logic:
if ( !isset( $cache[ $key ] ) ) { $arcresults = $wpdb->get_results($query); $cache[ $key ] = $arcresults; wp_cache_add( 'wp_get_archives', $cache, 'general' ); } else { $arcresults = $cache[ $key ]; }
So, I’m curious…for my custom function(s) (or for anyone doing custom queries for plugins), should we/I be using similar logic to store/retrieve results from cache?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Using cache functions with plugins or custom functions’ is closed to new replies.