15 const MAX_PRELOAD = 256;
35 $this->_callable_cache_checker =
function (
$guid) use ($entity_cache) {
38 $this->_callable_entity_loader =
function (
$options) {
52 public function preload($objects, array $guid_properties) {
53 $guids = $this->getGuidsToLoad($objects, $guid_properties);
58 call_user_func($this->_callable_entity_loader, [
60 'limit' => self::MAX_PRELOAD,
77 if (!is_array($objects) ||
count($objects) < 2) {
83 if (is_object($object)) {
84 foreach ($guid_properties as $property) {
85 if (empty($object->{$property})) {
89 $guid = $object->{$property};
90 if (
$guid && !call_user_func($this->_callable_cache_checker,
$guid)) {
91 $preload_guids[] =
$guid;
97 return array_unique($preload_guids);
__construct(EntityCache $entity_cache)
Constructor.
if($who_can_change_language=== 'nobody') elseif($who_can_change_language=== 'admin_only'&&!elgg_is_admin_logged_in()) $options
Volatile cache for entities.
getGuidsToLoad($objects, array $guid_properties)
Get GUIDs that need to be loaded.
$guids
Activates all specified installed and inactive plugins.
if($email instanceof\Elgg\Email) $object
load(int $guid)
Retrieve a entity from the cache.
preload($objects, array $guid_properties)
Preload entities based on the given objects.
Preload entities based on properties of fetched objects.
$guid
Reset an ElggUpgrade.