diff --git a/framework/Core/lib/Horde/Core/ActiveSync/Connector.php b/framework/Core/lib/Horde/Core/ActiveSync/Connector.php index 1a0f3ef6591..8e106fdfafc 100644 --- a/framework/Core/lib/Horde/Core/ActiveSync/Connector.php +++ b/framework/Core/lib/Horde/Core/ActiveSync/Connector.php @@ -317,9 +317,25 @@ public function contacts_getActionTimestamp($uid, $action, $addressbook = null) $uid, $action, $addressbook, $this->hasFeature('modseq', 'contacts')); } + /** + * Returns the favouriteRecipients data for RI requests. + * + * @param integer $max The maximum number of recipients to return. + * + * @return array An array of email addresses. + */ public function getRecipientCache($max = 100) { - return $this->_registry->mail->favouriteRecipients($max); + $cache = $GLOBALS['injector']->getInstance('Horde_Cache'); + $cache_key = 'HCASC:' . $this->_registry->getAuth() . ':' . $max; + if (!$cache->exists($cache_key, 3600)) { + $results = $this->_registry->mail->favouriteRecipients($max); + $cache->set($cache_key, json_encode($results)); + } else { + $results = json_decode($cache->get($cache_key, 3600)); + } + + return $results; } /**