diff --git a/include/class.queue.php b/include/class.queue.php
index b35f33b853851b870893e6b92ced743f744c1799..e6230001753346aca441ec4da623a7b84135fd1a 100644
--- a/include/class.queue.php
+++ b/include/class.queue.php
@@ -1299,8 +1299,11 @@ class CustomQueue extends VerySimpleModel {
         $nopath = !isset($this->path);
         $path_changed = isset($this->dirty['parent_id']);
 
-        if ($this->dirty)
+        if ($this->dirty) {
             $this->updated = SqlFunction::NOW();
+            // Refetch the queue counts
+            SavedQueue::clearCounts();
+        }
         if (!($rv = parent::save($refetch || $this->dirty)))
             return $rv;
 
diff --git a/include/class.search.php b/include/class.search.php
index eb720bcc26b3890b53a1d19d1430e8dd45def07a..6dad6141606b49e1b326d3b8507f921fe190a080 100644
--- a/include/class.search.php
+++ b/include/class.search.php
@@ -854,7 +854,15 @@ class SavedQueue extends CustomQueue {
         if (!$agent instanceof Staff)
             return array();
 
-        $queues = SavedQueue::objects()
+        if (function_exists('apcu_store')) {
+            $key = "counts.queues.{$agent->getId()}.".SECRET_SALT;
+            $cached = false;
+            $counts = apcu_fetch($key, $cached);
+            if ($cached === true)
+                return $counts;
+        }
+
+        $queues = static::objects()
             ->filter(Q::any(array(
                 'flags__hasbit' => CustomQueue::FLAG_QUEUE,
                 'staff_id' => $agent->getId(),
@@ -875,7 +883,23 @@ class SavedQueue extends CustomQueue {
             ));
         }
 
-        return $query->values()->one();
+        $counts = $query->values()->one();
+
+        if (function_exists('apcu_store')) {
+            $key = "counts.queues.{$agent->getId()}.".SECRET_SALT;
+            apcu_store($key, $counts, 3600);
+        }
+
+        return $counts;
+    }
+
+    static function clearCounts() {
+        if (function_exists('apcu_store')) {
+            $regex = '/^counts.queues.\d+.' . preg_quote(SECRET_SALT, '/') . '$/';
+            foreach (new APCUIterator($regex, APC_ITER_KEY) as $key) {
+                apcu_delete($key);
+            }
+        }
     }
 
     static function lookup($criteria) {
diff --git a/include/class.ticket.php b/include/class.ticket.php
index 9db2bff77390f8ccf2cf69811331bb28985a98d2..37c80c73c669fa1b9f59dbbebfed6eb563b3fc3d 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -3200,6 +3200,9 @@ implements RestrictedAccess, Threadable, Searchable {
     function save($refetch=false) {
         if ($this->dirty) {
             $this->updated = SqlFunction::NOW();
+            if (isset($this->dirty['status_id']))
+                // Refetch the queue counts
+                SavedQueue::clearCounts();
         }
         return parent::save($this->dirty || $refetch);
     }