diff --git includes/menu.inc includes/menu.inc
index 0c69896..75f3eae 100644
--- includes/menu.inc
+++ includes/menu.inc
@@ -1969,17 +1969,25 @@ function menu_contextual_links($module, $parent_path, $args) {
   // Performance: For a single, normalized path (such as 'node/%') we only query
   // available tasks once per request.
   if (!isset($data[$root_path])) {
-    // Get all contextual links that are direct children of the router item and
-    // not of the tab type 'view'.
-    $data[$root_path] = db_select('menu_router', 'm')
-      ->fields('m')
-      ->condition('tab_parent', $router_item['tab_root'])
-      ->condition('context', MENU_CONTEXT_NONE, '<>')
-      ->condition('context', MENU_CONTEXT_PAGE, '<>')
-      ->orderBy('weight')
-      ->orderBy('title')
-      ->execute()
-      ->fetchAllAssoc('path', PDO::FETCH_ASSOC);
+    $cid = 'contextual-links:' . $router_item['tab_root'];
+    if ($cache = cache_get($cid, 'cache_menu')) {
+      $data[$root_path] = $cache->data;
+    }
+    else {
+      // Get all contextual links that are direct children of the router item
+      // and not of the tab type 'view'.
+      $data[$root_path] = db_select('menu_router', 'm')
+        ->fields('m')
+        ->condition('tab_parent', $router_item['tab_root'])
+        ->condition('context', MENU_CONTEXT_NONE, '<>')
+        ->condition('context', MENU_CONTEXT_PAGE, '<>')
+        ->orderBy('weight')
+        ->orderBy('title')
+        ->execute()
+        ->fetchAllAssoc('path', PDO::FETCH_ASSOC);
+
+      cache_set($cid, $data[$root_path], 'cache_menu');
+    }
   }
   $parent_length = drupal_strlen($root_path) + 1;
   $map = $router_item['original_map'];
