/** * @param MediawikiApi $api * @param WikidataQueryApi|null $wikidataQueryApi * @param EntityStoreOptions|null $options */ public function __construct(MediawikiApi $api, WikidataQueryApi $wikidataQueryApi = null, EntityStoreOptions $options = null) { parent::__construct($options); $this->entityLookup = $this->newEntityLookup($api); $this->entityIdsForTermLookup = $this->newEntityForTermLookup($api); $this->wikidataQueryApi = $wikidataQueryApi; }
/** * @param EntityStore $entityStore * @param Cache $cache * @param int $lifeTime */ public function __construct(EntityStore $entityStore, Cache $cache, $lifeTime = 0) { parent::__construct(); $this->entityStore = $entityStore; $this->entityCache = new EntityDocumentCache($cache, $lifeTime); $this->entityIdForTermCache = new EntityIdForTermCache($cache, $lifeTime); $this->entityIdForQueryCache = new EntityIdForQueryCache($cache, $lifeTime); }
/** * @param Database $database * @param EntityStoreOptions $options */ public function __construct(Database $database, EntityStoreOptions $options = null) { $this->database = $database; parent::__construct($options); $this->defaultOption(self::OPTION_QUERY_TIME_LIMIT, null); $entityDatabase = $this->newEntityDatabase($database); $this->entityLookup = new DispatchingEntityLookup($entityDatabase); $this->entityForTermLookup = new DispatchingEntityIdForTermLookup($this->newEntityIdForTermLookup($database)); $this->entityForQueryLookup = new DispatchingEntityIdForQueryLookup($this->newEntityIdForQueryLookup($database)); $this->entitySaver = $entityDatabase; }
/** * @param EntityDocument[] $entities */ public function __construct(array $entities) { parent::__construct(); $this->entityLookup = new DispatchingEntityLookup(new InMemoryEntityLookup($entities)); }