34 $this->_callable_cache_checker =
function (
$guid) use ($entity_cache) {
37 $this->_callable_entity_loader =
function (
$options) use ($entity_table) {
51 public function preload($objects, array $guid_properties) {
52 $guids = $this->getGuidsToLoad($objects, $guid_properties);
56 call_user_func($this->_callable_entity_loader, array(
58 'limit' => EntityCache::MAX_SIZE,
73 if (!is_array($objects) || count($objects) < 2) {
76 $preload_guids = array();
79 foreach ($guid_properties as $property) {
80 if (empty(
$object->{$property})) {
84 if (
$guid && !call_user_func($this->_callable_cache_checker,
$guid)) {
85 $preload_guids[] =
$guid;
90 return array_unique($preload_guids);
Volatile cache for entities.
get($guid)
Retrieve a entity from the cache.
getEntities(array $options=array())
Returns an array of entities with optional filtering.
Preload entities based on properties of fetched objects.
getGuidsToLoad($objects, array $guid_properties)
Get GUIDs that need to be loaded.
preload($objects, array $guid_properties)
Preload entities based on the given objects.
__construct(EntityCache $entity_cache, EntityTable $entity_table)
Constructor.
$guid
Removes an admin notice.
$object
These two snippets demonstrates triggering an event and how to register for that event.