### Eclipse Workspace Patch 1.0
#P drupal5
Index: sites/all/modules/views_bookmark/views_bookmark.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views_bookmark/views_bookmark.module,v
retrieving revision 1.6.2.4
diff -u -r1.6.2.4 views_bookmark.module
--- sites/all/modules/views_bookmark/views_bookmark.module	13 Jul 2007 05:21:00 -0000	1.6.2.4
+++ sites/all/modules/views_bookmark/views_bookmark.module	13 Jul 2007 06:42:39 -0000
@@ -874,15 +874,22 @@
  * 
  * @param $nid
  *   The node id
+ * @param $reset
+ *   Reset the internal cache and execute the SQL query another time.
  * 
  * @return $bookmarks
  *   An array of the structure [vbid] => array('type' => bookmark name, 'count' => number of bookmarks) etc.
  */
-function views_bookmark_get_counts($nid) {
-  $bookmarks = array();
-  $result = db_query('SELECT b.vbid, b.title, nc.count FROM {views_bookmarks} b LEFT JOIN {views_bookmark_node_count} nc ON b.vbid = nc.vbid WHERE nc.nid = %d', $nid);
-  while ($row = db_fetch_object($result))  {
-    $bookmarks[$row->vbid] = array('type' => $row->title, 'count' => $row->count);
+function views_bookmark_get_counts($nid, $reset = FALSE) {
+  static $counts;
+
+  if (!isset($counts[$nid])) {
+    $counts[$nid] = array();
+    $result = db_query('SELECT b.vbid, b.title, nc.count FROM {views_bookmarks} b LEFT JOIN {views_bookmark_node_count} nc ON b.vbid = nc.vbid WHERE nc.nid = %d', $nid);
+    while ($row = db_fetch_object($result))  {
+      $counts[$nid][$row->vbid] = array('type' => $row->title, 'count' => $row->count);
+    }
   }
-  return $bookmarks;
+
+  return $counts[$nid];
 }
