Save metadatas to disk

@param  string $id        Cache id
@param  array  $metadatas Associative array
@return boolean True if no problem
334844
protected function _saveMetadatas($id, $metadatas)
    {
        $file = $this->_metadatasFile($id);
        $result = $this->_filePutContents($file, serialize($metadatas));
        if (!$result) {
            return false;
        }
        return true;
    }
984404
public function add($id, $data = 1)
    {
        try {
            return $this->resource->hSet(static::CACHE_KEY, $id, $data);
        } catch (ConnectionException $e) {
            return false;
        }
    }
379781
public function findMeta($id, $key)
    {
        $meta = $this->getMeta($id);

        if (is_string($result = $meta->get($key))) {
            return $result;
        }

        return new Collection($result);
    }
1119494
public function setContent($content, $metadata = array())
    {
        $this->content = $content;
        $this->setMetadata($metadata);

        return $this->size = $this->filesystem->write($this->key, $this->content, true);
    }
1166206
protected function doSave($id, $data, $lifeTime = false)
    {
        if (!$lifeTime) {
            $this->cache->forever($id, $data);
        } else {
            $this->cache->put($id, $data, $lifeTime);
        }

        return true;
    }
140100
private function dumpMetadata(array $metadata, InputInterface $input, OutputInterface $output)
    {
        foreach ($metadata as $name => $meta) {
            $output->writeln(sprintf('<info>%s</info>', $name));

            foreach ($meta['fields'] as $fieldName => $columnName) {
                $output->writeln(sprintf('  <comment>></comment> %s <info>=></info> %s', $fieldName, $columnName));
            }
        }
        $output->writeln('---------------');
        $output->writeln('----  END  ----');
        $output->writeln('---------------');
        $output->writeln('');

        if ($input->getOption('filename')) {
            $directory = \dirname($input->getOption('filename'));
            $filename = basename($input->getOption('filename'));

            if (empty($directory) || '.' === $directory) {
                $directory = getcwd();
            }

            $adapter = new LocalAdapter($directory, true);
            $fileSystem = new Filesystem($adapter);
            $success = $fileSystem->write($filename, json_encode($metadata), true);

            if ($success) {
                $output->writeLn(sprintf('<info>File %s/%s successfully created</info>', $directory, $filename));
            } else {
                $output->writeLn(sprintf('<error>File %s/%s could not be created</error>', $directory, $filename));
            }
        }
    }
408097
public function insert(ClassMetadataInfo $classMetadata, $id, $xmlContent)
    {
        $this->prepareStoragePathForClass($this->resolveClassName($classMetadata));

        $filePath = $this->getFilename($classMetadata, $id);
        $result = file_put_contents($filePath, $xmlContent);

        if (false === $result) {
            // @codeCoverageIgnoreStart
            throw new StorageException("Entity '$id' could not be saved to the filesystem at '$filePath'");
            // @codeCoverageIgnoreEnd
        }

        return $result > 0;
    }
104121
protected function saveMetas()
    {
        $metas = '<?php return '.var_export($this->metas->getAll(), true).';';
        file_put_contents($this->getMetaFile(), $metas);
    }
396759
public function isCached($id) {
        if ($id != null) {
            $id = $this->getIDfromOjb($id);
        }

        if ($id == null)
            return false;

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

        if (file_exists($cachefile) && time() - $cachetime < fileatime($cachefile)) {
            return true;
        }

        return false;
    }
1356395
public function updateMeta($id, array $arguments)
    {
        $parameters = $this->resolveMetaArguments($arguments);

        return $this->resolveMeta('save', [
            $id,
            $parameters['key'],
            $parameters['value'],
        ]);
    }
1233962
public function save($id, $data, $lifeTime = 0)
    {
        return $this->cacheProvider->save($id, $data, $lifeTime);
    }
1282354
protected function saveRelatedMeta($content_id, $items) {
        foreach ($items as $row) :
            if (trim($row['meta_key']) != '' && trim($row['meta_value']) != '') :
                $metaTable = TableRegistry::get('CmsContentMeta');
                $meta = $metaTable->newEntity();
                $meta->cms_content_id = $content_id;
                $meta->meta_key = $row['meta_key'];
                $meta->meta_value = $row['meta_value'];
                $metaTable->save($meta);
            endif;
        endforeach;
    }
143714
public function saveById($id, $data)
    {
        $this->getRequest()->putContents($this->getKey(), $id, $data);
        return $id;
    }
301047
public function saveRawProperties( $id, $properties )
    {
        $result = 0;

        if ( ! empty( $properties ) )
        {
            foreach ( $properties as $property )
            {
                $result += $this->saveProperty(
                    $id,
                    empty( $property['locale'] ) ? null : $property['locale'],
                    empty( $property['name']   ) ? null : $property['name'],
                    empty( $property['value']  ) ? null : $property['value']
                );
            }
        }

        return $result;
    }
619208
public function AllocateIds(\Google\Cloud\Datastore\V1\AllocateIdsRequest $argument,
      $metadata = [], $options = []) {
        return $this->_simpleRequest('/google.datastore.v1.Datastore/AllocateIds',
        $argument,
        ['\Google\Cloud\Datastore\V1\AllocateIdsResponse', 'decode'],
        $metadata, $options);
    }
62219
public function write($id, $data)
    {
        $session = $this->entityManager->find($this->entityManager, $id);
        if (null === $session) {
            $session = new $this->entityName();
            $session->{$this->primaryKeyColumn} = $id;
        }

        $session->{$this->dataColumn} = $data;
        $session->{$this->lifetimeColumn} = $this->lifetime;
        $session->{$this->modifiedColumn} = time();
        $this->entityManager->persist($session);

        try {
            $this->entityManager->flush();
            return true;
        } catch (\Doctrine\ORM\OptimisticLockException $exc) {
            return false;
        }
    }
10884
public function save($data, $id, $tags = array(), $specificLifetime = false)
    {
        $result = parent::save($data, $id, array(), $specificLifetime);
        if ($tags) {
            if (!method_exists($this->_handle, 'tag_add')) {
                \Zend_Cache::throwException('Method tag_add() is not supported by the PHP memcached extension!');
            }
            foreach ($tags as $tag) {
                $this->_handle->tag_add($tag, $id);
            }
            return true;
        }
        return $result;
    }