Transients vs CRON +Custom Fields: Caching Data Per Post
I think I would write a wrapper function around custom fields, something like this: function get_post_transient( $post_ID, $meta_key, $update_function ) { $current_value = get_post_meta( $post_ID, $meta_key, true ); if ( is_array( $current_value ) && $current_value[‘expiration’] < date(‘U’) ) return $current_value[‘data’]; $new_value = call_user_function( $update_function, $post_ID ); update_post_meta( $post_ID, $meta_key, $new_value ); return $new_value[‘data’]; } and … Read more