Put a document into this class' internal cache.

@param string $documentId ID to get from cache.
@param mixed $value Object to store.
@return \Chill\Document[]|array
778184
protected function setCache($documentId, $value)
    {
        $this->cache[$documentId] = $value;

        return $this->cache[$documentId];
    }
136150
protected function storageDataStructure($value)
    {
        if (\is_array($value)) {
            return \serialize($value);
        }

        return (\is_object($value)) ? clone $value : $value;
    }
696320
public function put($id, $value, $tags = [], DateTime $until = null)
    {

        $entry = $this->entryTemplate;

        $canSerialize = $this->canSerialize($value);
        $shouldSerialize = $this->shouldSerialize($value);
        $isPlain = true;

        if (!$canSerialize && !$this->bigStorage) {
            throw new UnexpectedValueException('Cannot store a value of type ' . Type::of($value) . '. Assign a big storage who supports that.');
        }

        // Lets save some memory and try not to copy value more around than
        // necessary

        $plainValue = null;

        if ($shouldSerialize) {
            $plainValue = $value;
            $value = $this->serializer->serialize($value);
            $isPlain = false;
        }

        // $value is now string || resource
        $writtenOutside = $this->writeToBigStorageIfNeeded($id, $value);

        $validUntil = $until ? $until->getTimestamp() : 0;

        $entry['plain'] = (int)$isPlain;
        $entry['outside'] = (int)$writtenOutside;
        $entry['payload'] = $writtenOutside ? '' : $value;
        $entry['tags'] = $tags ? ('|' . implode('|', $tags) . '|') : '';
        $entry['valid_until'] = $until ? $until->getTimestamp() : 0;


        $this->writeStorage[$id] = $entry;

        // Write the unserialized value back to put it into the memory cache
        if (!$isPlain && !$writtenOutside) {
            $entry['plain'] = 1;
            $entry['payload'] = $plainValue;
        }

        $this->entryCache[$id] = $entry;

    }
615709
public function addDocumentSignatures(\AgentSIB\Diadoc\Api\Proto\Events\DocumentSenderSignature $value)
    {
        if ($this->DocumentSignatures === null) {
            $this->DocumentSignatures = new \Protobuf\MessageCollection();
        }

        $this->DocumentSignatures->add($value);
    }
1253697
public function add($key, $value, $expiration = null)
    {
        if (null !== $this->logger) {
            $this->logger->startMethod('add', ['key' => $key, 'value' => $value, 'expiration' => $expiration]);
        }

        if (!$this->assertConnected()) {
            $this->setResultFailed(5); // \Memcached::RES_WRITE_FAILURE
            $this->stopMethod();

            return false;
        }

        if (!$this->assertKey($key)) {
            $this->stopMethod();

            return false;
        }

        $key = $this->getPrefix().$key;
        $this->checkForDelayedDelete($key);
        if (!$this->assertHasNotInDeleteQueue($key)) {
            $this->setResultFailed(12); // \Memcached::RES_DATA_EXISTS doc states \Memcached::RES_NOTSTORED :(
            $this->stopMethod();

            return false;
        }

        if (!$this->assertHasNotInCache($key)) {
            $this->setResultFailed(12); // \Memcached::RES_DATA_EXISTS doc states \Memcached::RES_NOTSTORED :(
            $this->stopMethod();

            return false;
        }

        if (!$this->assertValue($value)) {
            $this->stopMethod();

            return false;
        }

        if (!$this->assertExpiration($expiration)) {
            $this->stopMethod();

            return false;
        }

        $this->storeValueInCache($key, $value, $expiration);
        $this->setResultOK();
        $this->stopMethod();

        return true;
    }
1065290
public function transform($value)
    {
        if (null === $value) {
            return array();
        }
        if($this->identifier){
            return $this->identifier->getValue($value);
        }

        return $value->getId();
    }
1004528
public function transform($value)
    {
        try {
            return array(
                'id' => (null !== $value ? $value->getId() : null),
                'value' => (null !== $value ? $value->__toString() : null)
            );
        } catch (EntityNotFoundException $e) {
            return ['id' => null, 'value' => '-- ENTITY NOT FOUND --'];
        }
    }
670689
public static function saveToCache($id, $value)
    {
        $arrayCache = Configuration::getArrayCache();
        $cacheDriver = Configuration::getCacheDriver();

        $arrayCache->save($id, $value);
        if ($cacheDriver !== null) {
            $cacheDriver->save($id, $value);
        }
    }
171937
public void put(Id id, Object value, Mode mode) {
        if (Mode.WRITE.equals(mode)) {
            writeCache.put(id, value);
        }
        readCache.put(new CacheKey(id), value);
    }
582899
public function setIgnoreDocumentGutter($value = TRUE) {
    if ($this->validateIgnoreDocumentGutter($value)) {
      $this->ignoreDocumentGutter = $value;
    }
    return $this;
  }
843311
public function getDocumentById($documentId)
    {
        /* @var $query SearchQuery */
        $query = $this->queryBuilder->newSearchQuery($documentId)->useQueryFields(QueryFields::fromString('id'))->getQuery();
        $response = $this->search->search($query, 0, 1);
        $parsedData = $response->getParsedData();
        $resultDocument = isset($parsedData->response->docs[0]) ? $parsedData->response->docs[0] : null;

        if (!$resultDocument instanceof Document) {
            throw new \UnexpectedValueException("Response did not contain a valid Document object");
        }

        return $this->searchResultBuilder->fromApacheSolrDocument($resultDocument);
    }
950636
public function insert(array $values)
    {
        // Since every insert gets treated like a batch insert, we will have to detect
        // if the user is inserting a single document or an array of documents.
        $batch = true;

        foreach ($values as $value) {
            // As soon as we find a value that is not an array we assume the user is
            // inserting a single document.
            if (!is_array($value)) {
                $batch = false;
                break;
            }
        }

        if (!$batch) {
            $values = [$values];
        }

        // Batch insert
        $result = $this->collection->insertMany($values);

        return (1 == (int) $result->isAcknowledged());
    }
1064117
public function setValue($value): RedisCache
    {
        $redisclient = $this->getRedisConfig()->__invoke();
        $RedisData = (new RedisData())
            ->setData($value);
        $this->value = serialize($RedisData);
        $redisclient->setex($this->getKey(), $this->getExpire(), $this->getValue());

        return $this;
    }
1354533
public function put($id, $value, $tags = [], DateTime $until = null)
    {
        $this->forget($id);
        $this->cache[$id] = $value;
        $this->id2Tags[$id] = $tags;

        foreach ($tags as $tag) {
            if (!isset($this->tag2Ids[$tag])) {
                $this->tag2Ids[$tag] = [];
            }
            $this->tag2Ids[$tag][$id] = true;
        }
    }
177025
public function put($name, $value = null)
    {
        if ($name == []) {
            return $this;
        }

        $newValues = $name;

        if (! is_array($name)) {
            $newValues = [$name => $value];
        }

        $newContent = array_merge($this->all(), $newValues);

        $this->setContent($newContent);

        return $this;
    }
11402
public function cacheVal($value, $id = null) {
        if ($id == null) {
            if (is_object($value))
                $id = $this->getIDfromOjb($value);

            if ($id == null && $this->getConfig('debug')) {
                echo "no caching key";
                return $value;
            }
        }

        $cachefile = $this->getConfig('cacheDir') . '/' . utf8_decode($id);
        $cachetime = $this->getConfig('cacheTime');

        if (file_exists($cachefile) && time() - $cachetime < fileatime($cachefile)) {
            $ser = file_get_contents($cachefile);
            $val = bzdecompress(unserialize($ser));
            return $val;
        } else {
            $ser = bzcompress(serialize($value));
            file_put_contents($cachefile, $ser);
            return $value;
        }

        if ($this->getConfig('debug'))
            echo "no caching";
    }
63380
public function downloadDocuments(
        array $documentIds = array(),
        array $typeCodes = array()
    ) {
        $this->restClient->getConfig()->setPath(
            'request.options/headers/Authorization',
            $this->operatorKey
        );
        $command = $this->restClient->getCommand(
            'DownloadDocuments',
            array(
                'documentIds' => $documentIds,
                'typeCodes' => $typeCodes,
            )
        );

        $command[AbstractCommand::RESPONSE_PROCESSING] = AbstractCommand::TYPE_RAW;

        return $this->restClient->execute($command)->getBody();
    }