diff --git a/plugins/flag.inc b/plugins/flag.inc
new file mode 100644
index 0000000..546fee7
--- /dev/null
+++ b/plugins/flag.inc
@@ -0,0 +1,38 @@
+<?php
+
+class views_content_cache_key_flag extends views_content_cache_key {
+  function options_form($value, &$handler) {
+    // Get list of flags
+    $options = array();
+    $flags = flag_get_flags();
+    foreach ($flags as $fid => $flag) {
+      $description = '';
+      $description = 'flag type: <em>'. $flag->content_type .'</em>';
+      if (($flag->content_type == 'node' || $flag->content_type == 'comment') && count($flag->types)) {
+        $description .= '<br />node types: <em>'. implode(', ', $flag->types) .'</em>';
+      }
+      $options[$flag->fid] = $flag->title . '<br />'. $description;
+    }
+    natcasesort($options);
+
+    return array(
+      '#title' => t('Flags'),
+      '#description' => t('Checks for flag and unflag actions for the selected flags.'),
+      '#type' => 'checkboxes',
+      '#options' => $options,
+      '#default_value' => $value,
+      '#weight' => -10,
+    );
+  }
+
+  function content_key($object, $object_type) {
+    if ($object_type === 'flag') {
+      return $object->fid;
+    }
+  }
+
+  function clause_mode() {
+    // We can't be combined with other cache segments:
+    return 'OR';
+  }
+}
\ No newline at end of file
diff --git a/views_content_cache.module b/views_content_cache.module
index 253926e..785b965 100644
--- a/views_content_cache.module
+++ b/views_content_cache.module
@@ -60,6 +60,13 @@ function views_content_cache_votingapi_results($cached, $content_type, $content_
 }
 
 /**
+ * Implementation of hook_flag().
+ */
+function views_content_cache_flag($action, $flag, $content_id, $account) {
+  views_content_cache_update_set($flag, 'flag');
+}
+
+/**
  * Create one or more update records for the given object.
  *
  * @param object $object
@@ -449,6 +456,18 @@ function views_content_cache_views_content_cache_plugins() {
       ),
     );
   }
+  if (module_exists('flag')) {
+    $plugins['flag'] = array(
+      'title' => t('Flag'),
+      'description' => t('Invalidates cache when content is flagged'),  
+      'handler' => array(
+        'path' => drupal_get_path('module', 'views_content_cache') . '/plugins',
+        'file' => 'flag.inc',
+        'class' => 'views_content_cache_key_flag',
+        'parent' => 'base',
+      ),
+    );
+  }
   if (module_exists('votingapi')) {
     $plugins['votingapi'] = array(
       'handler' => array(
