Get documents from pool if they stored

@param array $ids
328204
public function getDocumentsFromDocumentPool(array $ids = null)
    {
        if (!$ids) {
            return $this->documentPool;
        }

        return array_intersect_key(
            $this->documentPool,
            array_flip(array_map('strval', $ids))
        );
    }
162589
public function batchDelete($ids) {
        $requests = [];

        foreach ($ids as $id) {
            $requests[] = [
                'method' => 'monitoring.livestatus.delete',
                'params' => [
                    'id' => $id
                ]
            ];
        }

        $result = $this->api->batchRequest($requests);

        foreach ($result as $tag) {
            // Do not check 'id' because in a batch request it is always NULL:
            if (!array_key_exists('success', $tag) ||
                $tag['success'] !== true) {
                if (array_key_exists('message', $tag)) {
                    throw new RuntimeException(sprintf('Bad result: %s', $tag['message']));
                } else {
                    throw new RuntimeException('Bad result');
                }
            }
        }

        return $this;
    }
260365
protected function _getFindConfig(array $ids)
    {
        $config = (array)$this->getConfig('findConfig');
        if (!empty($config)) {
            return $config;
        }

        $primaryKey = $this->_table()->getPrimaryKey();
        $config['conditions'] = [];
        $config['conditions'][] = function ($exp) use ($primaryKey, $ids) {
            return $exp->in($primaryKey, $ids);
        };

        return $config;
    }
82233
protected function doFetch(array $ids)
    {
        if ( ! $ids) {
            return [];
        }

        return $this->redis->hmget($this->namespace, $this->keys($ids));
    }
301671
protected function findObjects(array $ids)
    {
        $foundObjects = $this->domain->getRepository()->findBy([
            $this->identifier => array_unique($ids),
        ]);
        $mapFinds = [];
        $objects = [];

        foreach ($foundObjects as $foundObject) {
            $id = $this->propertyAccessor->getValue($foundObject, $this->identifier);
            $mapFinds[$id] = $foundObject;
        }

        foreach ($ids as $i => $id) {
            $objects[$i] = $mapFinds[$id]
                ?? $this->domain->newInstance($this->defaultValueOptions);
        }

        return $objects;
    }
494951
private function deleteCacheItems(array $ids) {
    $chunks = array_chunk($ids, 10);
    foreach ($chunks as $chunk) {
      $entities = SessionInstance::loadMultiple($chunk);
      $this->storage->delete($entities);
    }
  }
1153271
public static function get_many(array $ids) {
        global $DB;
        $coursecatrecordcache = cache::make('core', 'coursecatrecords');
        $categories = $coursecatrecordcache->get_many($ids);
        $toload = array();
        foreach ($categories as $id => $result) {
            if ($result === false) {
                $toload[] = $id;
            }
        }
        if (!empty($toload)) {
            list($where, $params) = $DB->get_in_or_equal($toload, SQL_PARAMS_NAMED);
            $records = self::get_records('cc.id '.$where, $params);
            $toset = array();
            foreach ($records as $record) {
                $categories[$record->id] = new self($record);
                $toset[$record->id] = $categories[$record->id];
            }
            $coursecatrecordcache->set_many($toset);
        }
        return $categories;
    }
606863
public function getJobs(array $ids, $indexFrom = 0)
    {
        $jobs = $this->connection()->pipeline(function ($pipe) use ($ids) {
            foreach ($ids as $id) {
                $pipe->hmget($id, $this->keys);
            }
        });

        return $this->indexJobs(collect($jobs)->filter(function ($job) {
            $job = is_array($job) ? array_values($job) : null;

            return is_array($job) && $job[0] !== null && $job[0] !== false;
        })->values(), $indexFrom);
    }
525744
private function groupIdsByFile(array $ids) : array
    {
        $covered = [];

        foreach ($ids as $id) {
            $file = mb_substr($id, 0, (int) mb_strpos($id, '::'));

            if (!isset($covered[$file])) {
                $covered[$file] = [];
            }

            $covered[$file][] = mb_substr($id, mb_strpos($id, '::') + 2);
        }

        return $covered;
    }
401490
public function getByIds(array $ids)
    {
        if (empty($ids)) {
            return null;
        }

        $parameters = array(
            'api_action' => 'list_list',
            'ids' => implode(',', $ids)
        );

        $response = $this->request($parameters);

        if ($response === null || $response->getStatusCode() !== 200) {
            return null;
        }

        $json = $response->getBody()->getContents();

        return $this->serializer->deserialize(
            $this->removeResultInformation($json),
            'array<integer, ' . \FondOfPHP\ActiveCampaign\DataTransferObject\MailingList::class . '>',
            'json'
        );
    }
1179807
public function findByIds($ids)
    {
        if (!is_array($ids)) {
            $ids = explode(',', $ids);
        }

        $items = $this->createValuedQueryBuilder('c')
            ->andWhere('c.id IN (:ids)')->setParameter('ids', $ids)
            ->andWhere('c.deletedAt IS NULL')
            ->getQuery()->useResultCache(true, self::CACHE_TTL)->getResult();

        return $this->sortByArray($items, $ids);
    }
580456
public function filter($ids = array())
    {
        $data = $this->get();
        $data = array_intersect($data, $ids);

        $this->meta          = array();
        $this->meta['count'] = count($data);
        $this->raw_data      = implode(self::SEPARATOR_ELEMENT, $data);
    }
443664
public function itemsGet($ids) {
		if ((!is_array($ids)) || (empty($ids))) {
			BLog::addToLog('[BItems.' . $this->tableName . '] itemsGet() $ids empty=' . var_export($ids, true) . ')', LL_ERROR);
			return array();
		}
		if (DEBUG_LOG_BITEMS) {
			BLog::addToLog('[BItems.' . $this->tableName . '] itemsGet(' . implode(',', $ids) . ')');
		}
		$items = array();
		//-------------------------------------------------
		//Trying to get items from internal cache
		//-------------------------------------------------
		$ids_c = array(); //IDs as integer
		$ids_k = array(); //IDs as external cache key
		foreach ($ids as $id) {
			$idd = is_array($id) ? implode(':', $id) : $id;
			if (isset($this->cacheItems[$idd])) {
				$items[$idd] = $this->cacheItems[$idd];
			} else {
				if (!empty($idd)) {
					$items[$idd] = NULL;
					$ids_c[$idd] = $id;
					$ids_k[$idd] = $this->tableName . ':itemid:' . $idd;
				}
			}
		}
		if (empty($ids_c)) {
			return $items;
		}

		//-------------------------------------------------
		//Trying to get left items from external cache
		//-------------------------------------------------
		$cache = BFactory::getCache();
		if (!empty($cache)) {
			$ids_m = array();
			$ids_q = array();
			$items_c = $cache->mget($ids_k);
			foreach ($ids_c as $id) {
				$idd = is_array($id) ? implode(':', $id) : $id;
				$key = $this->tableName . ':itemid:' . $idd;
				if ((isset($items_c[$key])) && (!empty($items_c[$key]))) {
					$classname = $this->itemClassName;
					$items[$idd] = new $classname();
					$items[$idd]->load($items_c[$key]);
					$this->cacheItems[$idd] = $items[$idd];
				} else {
					array_push($ids_m, $id);
					array_push($ids_q, $id);
				}
			}
		} else {
			$ids_m = $ids_c;
			$ids_q = $ids_c;
		}
		if (empty($ids_m)) {
			return $items;
		}
		//-------------------------------------------------
		// Trying to get left items from database
		//-------------------------------------------------
		$db = BFactory::getDBO();
		if (empty($db)) {
			return $items;
		}
		if (is_array($this->primaryKeyName)) {
			$whi = array();
			foreach ($ids_q as $id) {
				$s = array();
				foreach ($id as $idk => $idv) {
					$s[] = '(`' . $idk . '`=' . $db->escapeString($idv) . ')';
				}
				$whi[] = '(' . implode(' AND ', $s) . ')';
			}
			$wh = implode(' OR ', $whi);
			$qr = 'SELECT * from `' . $this->tableName . '` WHERE (' . $wh . ')';
		} else {
			$qr = 'SELECT * from `' . $this->tableName . '` WHERE (`' . $this->primaryKeyName . '` in (' . implode(',', $ids_q) . '))';
		}
		$q = $db->Query($qr);
		if (empty($q)) {
			BLog::addToLog('[items]: itemsGet(): Could not execute query! MySQL error: ' . $db->lasterror(), LL_ERROR);
			return $items;
		}
		$tocache = array();
		$item_obj = array();
		while ($l = $db->fetch($q)) {
			if (is_array($this->primaryKeyName)) {
				$id = array();
				foreach ($this->primaryKeyName as $pk) {
					$id[$pk] = $l[$pk];
				}
				$idd = implode(':', $id);
				$item_obj[$idd] = $l;
			} else {
				$idd = (int)$l[$this->primaryKeyName];
				$item_obj[$idd] = $l;
			}
			foreach ($this->linkedTables as $tbl) {
				$item_obj[$idd][$tbl['field']] = array();
			}
		}
		//-------------------------------------------------
		// Loading data from external tables...
		//-------------------------------------------------
		if (DEBUG_LOG_BITEMS) {
			BLog::addToLog('[BItems.' . $this->tableName . '] itemsGet() Loading data from external tables...');
		}
		foreach ($this->linkedTables as $tbl) {
			$wh = array();
			$wh[] = '(`' . $tbl['extkey'] . '` in (' . implode(',', $ids_q) . '))';
			if (!empty($tbl['filter'])) {
				$wh[] = $tbl['filter'];
			}
			$qrl = 'SELECT * from `' . $tbl['name'] . '` WHERE (' . implode(' AND ', $wh) . ')';
			$ql = $db->Query($qrl);
			if (empty($ql)) {
				BLog::addToLog('[items]: itemsGet(): Could not execute external tables query! MySQL error: ' . $db->lasterror(), LL_ERROR);
				return false;
			}
			$datal = array();
			while ($ll = $db->fetch($ql)) {
				$itemid = (int)$ll[$tbl['extkey']];
				$item_obj[$itemid][$tbl['field']][] = $ll;
			}
		}
		//-------------------------------------------------
		// Creating item object...
		//-------------------------------------------------
		if (DEBUG_LOG_BITEMS) {
			BLog::addToLog('[BItems.' . $this->tableName . '] itemsGet() Creating item objects...');
		}
		foreach ($item_obj as $k => $l) {
			$classname = $this->itemClassName;
			if (!class_exists($classname)) {
				$msg = 'Class "' . $classname . '" does not exist!';
				BLog::addToLog($msg, LL_ERROR);
				die($msg);
			}
			$items[$k] = new $classname();
			$items[$k]->load($l);
			$this->cacheItems[$k] = $items[$k];
			if (CACHE_TYPE) {
				$tocache[$this->tableName . ':itemid:' . $k] = $l;
			}
		}
		//-------------------------------------------------
		// Cache storing, if necessary.
		//-------------------------------------------------
		if ((!empty($cache)) && (count($tocache) != 0)) {
			$cache->mset($tocache, $this->cacheTime);//1 hour
		}
		if (DEBUG_LOG_BITEMS) {
			BLog::addToLog('[BItems.' . $this->tableName . '] itemsGet() All done! Returning items.');
		}
		return $items;
	}
6131
public static function selectByIds($ids, array $options = [], array $criteria = [])
    {
        $criteria = static::cleanCriteria($criteria);
        if (empty($criteria)) {
            $criteria['select'] = ['*'];
        }

        if (is_array($ids)) {
            $ids = implode(',', $ids);
        }

        $pk = static::getPrimaryKeyStatic();
        if (!empty($ids)) {
            $idsPhrase = " $pk IN ($ids) ";

            $condition = array_get($criteria, 'condition');

            if (!empty($condition)) {
                $condition .= ' AND ' . $idsPhrase;
            } else {
                $condition = $idsPhrase;
            }

            $criteria['condition'] = $condition;
        }

        $data = static::selectByRequest($criteria, $options);

        $data = static::cleanResult($data, array_get($criteria, 'select'));
        if (!is_array($ids)) {
            $ids = explode(',', $ids);
        }
        if (count($data) != count($ids)) {
            $out = [];
            $continue = array_get_bool($options, ApiOptions::CONTINUES);
            foreach ($ids as $index => $id) {
                $found = false;
                foreach ($data as $record) {
                    if ($id == array_get($record, $pk)) {
                        $out[$index] = $record;
                        $found = true;
                        break;
                    }
                }
                if (!$found) {
                    $out[$index] = new NotFoundException("Record with identifier '$id' not found.");
                    if (!$continue) {
                        break;
                    }
                }
            }

            throw new BatchException($out, 'Batch Error: Not all requested records could be retrieved.');
        }

        return $data;
    }
618062
public function detach($ids = [])
    {
        if ($ids instanceof EntityCollection) {
            $ids = (array) $ids->modelKeys();
        }

        $query = $this->newPivotQuery();

        // If associated IDs were passed to the method we will only delete those
        // associations, otherwise all of the association ties will be broken.
        // We'll return the numbers of affected rows when we do the deletes.
        $ids = (array) $ids;

        if (count($ids) > 0) {
            $query->whereIn($this->otherKey, (array) $ids);
        }

        // Once we have all of the conditions set on the statement, we are ready
        // to run the delete on the pivot table. Then, if the touch parameter
        // is true, we will go ahead and touch all related models to sync.
        return $query->delete();
    }
411733
public function several(array $ids)
    {
        $results = [];

        foreach ($ids as $cacheId) {
            if ($this->cache->test($cacheId)) {
                $results[$cacheId] = $this->cache->load($cacheId);
            }

        }

        return $results;
    }
507280
public function findByIds(array $ids)
    {
        $entities = [];

        for ($i = 0; $i < count($this->registries); $i++) {
            /** @var RegistryInterface $registry */
            $registry = $this->registries[ $i ];
            $found = $registry->findByKeys($ids);
            $entities = array_merge($entities, $found);

            $this->updateRegistries($found, $i - 1);

            if (count($entities) === count($ids)) {
                break;
            }
        }

        return $entities;
    }