Keep kolab uids related to a message in memory for repeated queries
This commit is contained in:
parent
80f23d7d90
commit
f505abb350
1 changed files with 25 additions and 15 deletions
|
@ -760,6 +760,8 @@ class kolab_storage_config
|
||||||
*/
|
*/
|
||||||
public function get_message_relations($message, $folder, $type)
|
public function get_message_relations($message, $folder, $type)
|
||||||
{
|
{
|
||||||
|
static $_cache = array();
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
$uids = array();
|
$uids = array();
|
||||||
$default = true;
|
$default = true;
|
||||||
|
@ -777,7 +779,8 @@ class kolab_storage_config
|
||||||
}
|
}
|
||||||
$filter[] = array('member', '=', $member_id);
|
$filter[] = array('member', '=', $member_id);
|
||||||
|
|
||||||
// get UIDs of assigned notes
|
if (!isset($_cache[$uri])) {
|
||||||
|
// get UIDs of related groupware objects
|
||||||
foreach ($this->get_objects($filter, $default) as $relation) {
|
foreach ($this->get_objects($filter, $default) as $relation) {
|
||||||
// we don't need to update members if the URI is found
|
// we don't need to update members if the URI is found
|
||||||
if (!in_array($uri, $relation['members'])) {
|
if (!in_array($uri, $relation['members'])) {
|
||||||
|
@ -797,6 +800,13 @@ class kolab_storage_config
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// remember this lookup
|
||||||
|
$_cache[$uri] = $uids;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$uids = $_cache[$uri];
|
||||||
|
}
|
||||||
|
|
||||||
// get kolab objects of specified type
|
// get kolab objects of specified type
|
||||||
if (!empty($uids)) {
|
if (!empty($uids)) {
|
||||||
$query = array(array('uid', '=', array_unique($uids)));
|
$query = array(array('uid', '=', array_unique($uids)));
|
||||||
|
|
Loading…
Add table
Reference in a new issue