当前位置: 首页>>代码示例>>PHP>>正文


PHP Storage::getStorageCache方法代码示例

本文整理汇总了PHP中OC\Files\Storage\Storage::getStorageCache方法的典型用法代码示例。如果您正苦于以下问题:PHP Storage::getStorageCache方法的具体用法?PHP Storage::getStorageCache怎么用?PHP Storage::getStorageCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OC\Files\Storage\Storage的用法示例。


在下文中一共展示了Storage::getStorageCache方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: commitBatch

 /**
  * Commit the active propagation batch
  */
 public function commitBatch()
 {
     if (!$this->inBatch) {
         throw new \BadMethodCallException('Not in batch');
     }
     $this->inBatch = false;
     $this->connection->beginTransaction();
     $query = $this->connection->getQueryBuilder();
     $storageId = (int) $this->storage->getStorageCache()->getNumericId();
     $query->update('filecache')->set('mtime', $query->createFunction('GREATEST(`mtime`, ' . $query->createParameter('time') . ')'))->set('etag', $query->expr()->literal(uniqid()))->where($query->expr()->eq('storage', $query->expr()->literal($storageId, IQueryBuilder::PARAM_INT)))->andWhere($query->expr()->eq('path_hash', $query->createParameter('hash')));
     $sizeQuery = $this->connection->getQueryBuilder();
     $sizeQuery->update('filecache')->set('size', $sizeQuery->createFunction('`size` + ' . $sizeQuery->createParameter('size')))->where($query->expr()->eq('storage', $query->expr()->literal($storageId, IQueryBuilder::PARAM_INT)))->andWhere($query->expr()->eq('path_hash', $query->createParameter('hash')))->andWhere($sizeQuery->expr()->gt('size', $sizeQuery->expr()->literal(-1, IQueryBuilder::PARAM_INT)));
     foreach ($this->batch as $item) {
         $query->setParameter('time', $item['time'], IQueryBuilder::PARAM_INT);
         $query->setParameter('hash', $item['hash']);
         $query->execute();
         if ($item['size']) {
             $sizeQuery->setParameter('size', $item['size'], IQueryBuilder::PARAM_INT);
             $sizeQuery->setParameter('hash', $item['hash']);
             $sizeQuery->execute();
         }
     }
     $this->batch = [];
     $this->connection->commit();
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:28,代码来源:Propagator.php

示例2: propagateChange

 /**
  * @param string $internalPath
  * @param int $time
  * @param int $sizeDifference number of bytes the file has grown
  */
 public function propagateChange($internalPath, $time, $sizeDifference = 0)
 {
     $storageId = (int) $this->storage->getStorageCache()->getNumericId();
     $parents = $this->getParents($internalPath);
     $parentHashes = array_map('md5', $parents);
     $etag = uniqid();
     // since we give all folders the same etag we don't ask the storage for the etag
     $builder = $this->connection->getQueryBuilder();
     $hashParams = array_map(function ($hash) use($builder) {
         return $builder->expr()->literal($hash);
     }, $parentHashes);
     $builder->update('filecache')->set('mtime', $builder->createFunction('GREATEST(`mtime`, ' . $builder->createNamedParameter($time) . ')'))->set('etag', $builder->createNamedParameter($etag, IQueryBuilder::PARAM_STR))->where($builder->expr()->eq('storage', $builder->createNamedParameter($storageId, IQueryBuilder::PARAM_INT)))->andWhere($builder->expr()->in('path_hash', $hashParams));
     $builder->execute();
     if ($sizeDifference !== 0) {
         // we need to do size separably so we can ignore entries with uncalculated size
         $builder = $this->connection->getQueryBuilder();
         $builder->update('filecache')->set('size', $builder->createFunction('`size` + ' . $builder->createNamedParameter($sizeDifference)))->where($builder->expr()->eq('storage', $builder->createNamedParameter($storageId, IQueryBuilder::PARAM_INT)))->andWhere($builder->expr()->in('path_hash', $hashParams))->andWhere($builder->expr()->gt('size', $builder->expr()->literal(-1, IQueryBuilder::PARAM_INT)));
     }
     $builder->execute();
 }
开发者ID:stweil,项目名称:owncloud-core,代码行数:25,代码来源:Propagator.php

示例3: getStorageCache

 /**
  * @return \OC\Files\Cache\Storage
  */
 public function getStorageCache()
 {
     return $this->storage->getStorageCache();
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:7,代码来源:Wrapper.php


注:本文中的OC\Files\Storage\Storage::getStorageCache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。