Changeset 4520 for trunk/wp-includes/bookmark.php
- Timestamp:
- 11/23/2006 05:04:05 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/bookmark.php
r4495 r4520 20 20 // Deprecate 21 21 function get_link($bookmark_id, $output = OBJECT) { 22 return get_bookmark($bookmark_id, $output); 22 return get_bookmark($bookmark_id, $output); 23 23 } 24 24 … … 35 35 $r = array_merge($defaults, $r); 36 36 extract($r); 37 38 $key = md5( serialize( $r ) ); 39 if ( $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ) ) 40 if ( isset( $cache[ $key ] ) ) 41 return apply_filters('get_bookmarks', $cache[ $key ], $r ); 37 42 38 43 $inclusions = ''; … … 51 56 } 52 57 } 53 if (!empty($inclusions)) 58 if (!empty($inclusions)) 54 59 $inclusions .= ')'; 55 60 … … 66 71 } 67 72 } 68 if (!empty($exclusions)) 73 if (!empty($exclusions)) 69 74 $exclusions .= ')'; 70 75 71 76 if ( ! empty($category_name) ) { 72 77 if ( $cat_id = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$category_name' LIMIT 1") ) … … 88 93 } 89 94 if (!empty($category_query)) { 90 $category_query .= ')'; 95 $category_query .= ')'; 91 96 $join = " LEFT JOIN $wpdb->link2cat ON ($wpdb->links.link_id = $wpdb->link2cat.link_id) "; 92 97 } … … 129 134 130 135 $results = $wpdb->get_results($query); 136 137 $cache[ $key ] = $results; 138 wp_cache_set( 'get_bookmarks', $cache, 'bookmark' ); 139 131 140 return apply_filters('get_bookmarks', $results, $r); 132 141 } 133 142 143 function delete_get_bookmark_cache() { 144 wp_cache_delete( 'get_bookmarks', 'bookmark' ); 145 } 146 add_action( 'add_link', 'delete_get_bookmark_cache' ); 147 add_action( 'edit_link', 'delete_get_bookmark_cache' ); 148 add_action( 'delete_link', 'delete_get_bookmark_cache' ); 149 134 150 ?>
Note: See TracChangeset
for help on using the changeset viewer.