Created
May 24, 2016 21:05
-
-
Save spacedmonkey/763005309cdb1c852ff57e5ccb71a57b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$sql = "LIMIT 10"; | |
$cache_key = md5($sql); | |
$post_ids = wp_cache_get( $cache_key, 'keystone_redirects' ); | |
if( false === $post_ids ){ | |
$post_ids = $wpdb->get_col( $sql ); | |
$cache_time = (count($post_ids) > 0 ) ? MINUTE_IN_SECONDS : DAY_IN_SECONDS; | |
wp_cache_set( $cache_key, $post_ids, 'keystone_redirects', $cache_time ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment