diff options
| author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2006-11-24 16:16:44 +0000 |
|---|---|---|
| committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2006-11-24 16:16:44 +0000 |
| commit | 600b71019494e1c29898a620e58c0d2602f37b74 (patch) | |
| tree | 21181d77ad4ebbcd42cd883e509c08a568d29514 /wp-includes/bookmark.php | |
| parent | 7935d0bd9ef23d32ae29a95bd6c3ea0b6eab2973 (diff) | |
| download | wordpress-mu-600b71019494e1c29898a620e58c0d2602f37b74.tar.gz wordpress-mu-600b71019494e1c29898a620e58c0d2602f37b74.tar.xz wordpress-mu-600b71019494e1c29898a620e58c0d2602f37b74.zip | |
WP Merge to 4524
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@810 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/bookmark.php')
| -rw-r--r-- | wp-includes/bookmark.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/wp-includes/bookmark.php b/wp-includes/bookmark.php index 306a33f..2824a89 100644 --- a/wp-includes/bookmark.php +++ b/wp-includes/bookmark.php @@ -35,6 +35,11 @@ function get_bookmarks($args = '') { $r = array_merge($defaults, $r); extract($r); + $key = md5( serialize( $r ) ); + if ( $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ) ) + if ( isset( $cache[ $key ] ) ) + return apply_filters('get_bookmarks', $cache[ $key ], $r ); + $inclusions = ''; if ( !empty($include) ) { $exclude = ''; //ignore exclude, category, and category_name params if using include @@ -128,7 +133,18 @@ function get_bookmarks($args = '') { $query .= " LIMIT $limit"; $results = $wpdb->get_results($query); + + $cache[ $key ] = $results; + wp_cache_set( 'get_bookmarks', $cache, 'bookmark' ); + return apply_filters('get_bookmarks', $results, $r); } +function delete_get_bookmark_cache() { + wp_cache_delete( 'get_bookmarks', 'bookmark' ); +} +add_action( 'add_link', 'delete_get_bookmark_cache' ); +add_action( 'edit_link', 'delete_get_bookmark_cache' ); +add_action( 'delete_link', 'delete_get_bookmark_cache' ); + ?> |
