/** * @see Store::getPropertySubjects * * @since 2.3 * * @param DIWikiPage|null $subject * @param DIProperty $property * @param RequestOptions $requestOptions = null * * @return array */ public function getPropertySubjects(DIProperty $property, DataItem $dataItem = null, $requestOptions = null) { // The cache is not used for $dataItem === null (means all values for // the given property are returned) if ($dataItem === null || !$dataItem instanceof DIWikiPage || !$this->blobStore->canUse() || !$this->canUseValueLookupFeature(SMW_VL_PS)) { return $this->store->getReader()->getPropertySubjects($property, $dataItem, $requestOptions); } // Added as linked list as we keep the container ttl different from // that of the main container $sid = $this->getKeyForMainSubject($dataItem, 'ps'); $container = $this->blobStore->read($sid); $psid = HashBuilder::createHashIdForContent(array($property->getKey(), (array) $requestOptions, self::VERSION), 'ps:'); if ($container->has($psid)) { return $container->get($psid); } $result = $this->store->getReader()->getPropertySubjects($property, $dataItem, $requestOptions); $container->set($psid, $result); // We set a short lifetime (5 min) in order to cache repeated requests but // avoiding a complex invalidation during a subject update otherwise all // properties of a container would require scanning and removal $container->setExpiryInSeconds(60 * 5); $this->blobStore->save($container); $this->appendToList($sid, $dataItem); return $result; }