diff --git a/includes/rules.plugins.inc b/includes/rules.plugins.inc
index 2a4fa51..9365840 100644
--- a/includes/rules.plugins.inc
+++ b/includes/rules.plugins.inc
@@ -748,7 +748,7 @@ class RulesEventSet extends RulesRuleSet {
     // Cache a list of empty sets so we can use it to speed up later calls.
     // See rules_get_event_set().
     $empty_events = array_keys(array_diff_key($events, $sets));
-    variable_set('rules_empty_sets', array_flip($empty_events));
+    rules_empty_sets(array_flip($empty_events));
   }
 
   protected function stateVariables($element = NULL) {
diff --git a/rules.module b/rules.module
index 19ac295..2d4bdf3 100644
--- a/rules.module
+++ b/rules.module
@@ -337,7 +337,6 @@ function rules_set_cache($cid, $data) {
  * Implements hook_flush_caches().
  */
 function rules_flush_caches() {
-  variable_del('rules_empty_sets');
   return array('cache_rules');
 }
 
@@ -346,7 +345,6 @@ function rules_flush_caches() {
  */
 function rules_clear_cache() {
   cache_clear_all('*', 'cache_rules', TRUE);
-  variable_del('rules_empty_sets');
   drupal_static_reset('rules_get_cache');
   drupal_static_reset('rules_fetch_data');
   drupal_static_reset('rules_config_update_dirty_flag');
@@ -354,6 +352,39 @@ function rules_clear_cache() {
 }
 
 /**
+ * Maintains a cache of empty rules sets.
+ *
+ * @param set
+ *   An array of empty rules sets. If passed both the static and persistent
+ *   caches will be updated to the new value.
+ *
+ * @return
+ *   An array of empty rules sets.
+ */
+function rules_empty_sets($set = array()) {
+  static $empty_sets;
+  if ($set) {
+    $empty_sets = $set;
+    cache_set('rules_empty_sets', $set, 'cache_rules');
+    return $set;
+  }
+  else {
+    if (isset($empty_sets)) {
+      return $empty_sets;
+    }
+    else {
+      if ($cached = cache_get('rules_empty_sets', 'cache_rules')) {
+        $empty_sets = $cached->data;
+      }
+      else {
+        $empty_sets = array();
+      }
+      return $empty_sets;
+    }
+  }
+}
+
+/**
  * Imports the given export and returns the imported configuration.
  *
  * @param $export
@@ -822,14 +853,13 @@ function rules_invoke_all() {
  * @see rules_invoke_event_by_args()
  */
 function rules_invoke_event() {
-  global $conf;
-
   $args = func_get_args();
   $event_name = $args[0];
   unset($args[0]);
+  $empty_sets = rules_empty_sets();
   // For invoking the rules event we directly acccess the global $conf. This is
   // fast without having to introduce another static cache.
-  if (!defined('MAINTENANCE_MODE') && !isset($conf['rules_empty_sets'][$event_name]) && $event = rules_get_cache('event_' . $event_name)) {
+  if (!defined('MAINTENANCE_MODE') && !isset($empty_sets['event_name']) && $event = rules_get_cache('event_' . $event_name)) {
     $event->executeByArgs($args);
   }
 }
@@ -852,11 +882,11 @@ function rules_invoke_event() {
  * @see rules_invoke_event()
  */
 function rules_invoke_event_by_args($event_name, $args = array()) {
-  global $conf;
+  $empty_sets = rules_empty_sets();
 
   // For invoking the rules event we directly acccess the global $conf. This is
   // fast without having to introduce another static cache.
-  if (!defined('MAINTENANCE_MODE') && !isset($conf['rules_empty_sets'][$event_name]) && $event = rules_get_cache('event_' . $event_name)) {
+  if (!defined('MAINTENANCE_MODE') && !isset($empty_sets[$event_name]) && $event = rules_get_cache('event_' . $event_name)) {
     $event->executeByArgs($args);
   }
 }
