forked from GNUsocial/gnu-social
only do a db call if need to fetch some in listGet()
This commit is contained in:
parent
435c08a753
commit
447ae92eca
@ -172,6 +172,7 @@ class Memcached_DataObject extends Safe_DataObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (count($toFetch) > 0) {
|
||||||
$i = DB_DataObject::factory($cls);
|
$i = DB_DataObject::factory($cls);
|
||||||
if (empty($i)) {
|
if (empty($i)) {
|
||||||
throw new Exception(_('Cannot instantiate class ' . $cls));
|
throw new Exception(_('Cannot instantiate class ' . $cls));
|
||||||
@ -184,12 +185,12 @@ class Memcached_DataObject extends Safe_DataObject
|
|||||||
$result[$i->$keyCol][] = $copy;
|
$result[$i->$keyCol][] = $copy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($toFetch as $keyVal)
|
foreach ($toFetch as $keyVal)
|
||||||
{
|
{
|
||||||
self::cacheSet(sprintf("%s:list:%s:%s", $cls, $keyCol, $keyVal),
|
self::cacheSet(sprintf("%s:list:%s:%s", $cls, $keyCol, $keyVal),
|
||||||
$result[$keyVal]);
|
$result[$keyVal]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user