diff --git a/handlers/views_handler_relationship_groupwise_max.inc b/handlers/views_handler_relationship_groupwise_max.inc
index a3e7f6b2e91116ce74f36e1128aa5632bdf74a11..06dee325d7febaac25a8d3e4c3b255f84b82accf 100644
--- a/handlers/views_handler_relationship_groupwise_max.inc
+++ b/handlers/views_handler_relationship_groupwise_max.inc
@@ -169,7 +169,7 @@ function get_temporary_view() {
    */
   function options_form_submit(&$form, &$form_state) {
     $cid = 'views_relationship_groupwise_max:' . $this->view->name . ':' . $this->view->current_display . ':' . $this->options['id'];
-    cache_clear_all($cid, 'cache_views_data');
+    cache('views_data')->delete($cid);
   }
 
   /**
@@ -356,13 +356,13 @@ function query() {
     else {
       // Get the stored subquery SQL string.
       $cid = 'views_relationship_groupwise_max:' . $this->view->name . ':' . $this->view->current_display . ':' . $this->options['id'];
-      $cache = cache_get($cid, 'cache_views_data');
+      $cache = cache('views_data')->get($cid);
       if (isset($cache->data)) {
         $def['left_query'] = $cache->data;
       }
       else {
         $def['left_query'] = $this->left_query($this->options);
-        cache_set($cid, $def['left_query'], 'cache_views_data');
+        cache('views_data')->set($cid, $def['left_query']);
       }
     }