當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Cache::getIncomplete方法代碼示例

本文整理匯總了PHP中OC\Files\Cache\Cache::getIncomplete方法的典型用法代碼示例。如果您正苦於以下問題:PHP Cache::getIncomplete方法的具體用法?PHP Cache::getIncomplete怎麽用?PHP Cache::getIncomplete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OC\Files\Cache\Cache的用法示例。


在下文中一共展示了Cache::getIncomplete方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: backgroundScan

 /**
  * walk over any folders that are not fully scanned yet and scan them
  */
 public function backgroundScan()
 {
     $lastPath = null;
     while (($path = $this->cache->getIncomplete()) !== false && $path !== $lastPath) {
         $this->scan($path, self::SCAN_RECURSIVE, self::REUSE_ETAG);
         $this->cache->correctFolderSize($path);
         $lastPath = $path;
     }
 }
開發者ID:omusico,項目名稱:isle-web-framework,代碼行數:12,代碼來源:scanner.php

示例2: backgroundScan

	/**
	 * walk over any folders that are not fully scanned yet and scan them
	 */
	public function backgroundScan() {
		$lastPath = null;
		while (($path = $this->cache->getIncomplete()) !== false && $path !== $lastPath) {
			$this->scan($path, self::SCAN_RECURSIVE, self::REUSE_ETAG);
			\OC_Hook::emit('Scanner', 'correctFolderSize', array('path' => $path));
			if ($this->cacheActive) {
				$this->cache->correctFolderSize($path);
			}
			$lastPath = $path;
		}
	}
開發者ID:ninjasilicon,項目名稱:core,代碼行數:14,代碼來源:scanner.php

示例3: testGetIncomplete

 function testGetIncomplete()
 {
     $file1 = 'folder1';
     $file2 = 'folder2';
     $file3 = 'folder3';
     $file4 = 'folder4';
     $data = array('size' => 10, 'mtime' => 50, 'mimetype' => 'foo/bar');
     $this->cache->put($file1, $data);
     $data['size'] = -1;
     $this->cache->put($file2, $data);
     $this->cache->put($file3, $data);
     $data['size'] = 12;
     $this->cache->put($file4, $data);
     $this->assertEquals($file3, $this->cache->getIncomplete());
 }
開發者ID:Romua1d,項目名稱:core,代碼行數:15,代碼來源:cache.php

示例4: testBackgroundScan

 function testBackgroundScan()
 {
     $this->fillTestFolders();
     $this->storage->mkdir('folder2');
     $this->storage->file_put_contents('folder2/bar.txt', 'foobar');
     $this->scanner->scan('', \OC\Files\Cache\Scanner::SCAN_SHALLOW);
     $this->assertFalse($this->cache->inCache('folder/bar.txt'));
     $this->assertFalse($this->cache->inCache('folder/2bar.txt'));
     $cachedData = $this->cache->get('');
     $this->assertEquals(-1, $cachedData['size']);
     $this->scanner->backgroundScan();
     $this->assertTrue($this->cache->inCache('folder/bar.txt'));
     $this->assertTrue($this->cache->inCache('folder/bar.txt'));
     $cachedData = $this->cache->get('');
     $this->assertnotEquals(-1, $cachedData['size']);
     $this->assertFalse($this->cache->getIncomplete());
 }
開發者ID:0x17de,項目名稱:core,代碼行數:17,代碼來源:scanner.php

示例5: backgroundScan

 /**
  * walk over any folders that are not fully scanned yet and scan them
  */
 public function backgroundScan()
 {
     if (!$this->cache->inCache('')) {
         $this->runBackgroundScanJob(function () {
             $this->scan('', self::SCAN_RECURSIVE, self::REUSE_ETAG);
         }, '');
     } else {
         $lastPath = null;
         while (($path = $this->cache->getIncomplete()) !== false && $path !== $lastPath) {
             $this->runBackgroundScanJob(function () use($path) {
                 $this->scan($path, self::SCAN_RECURSIVE, self::REUSE_ETAG);
             }, $path);
             // FIXME: this won't proceed with the next item, needs revamping of getIncomplete()
             // to make this possible
             $lastPath = $path;
         }
     }
 }
開發者ID:stweil,項目名稱:owncloud-core,代碼行數:21,代碼來源:Scanner.php

示例6: testBackgroundScanOnlyRecurseIncomplete

 function testBackgroundScanOnlyRecurseIncomplete()
 {
     $this->fillTestFolders();
     $this->storage->mkdir('folder2');
     $this->storage->file_put_contents('folder2/bar.txt', 'foobar');
     $this->scanner->scan('', \OC\Files\Cache\Scanner::SCAN_SHALLOW);
     $this->assertFalse($this->cache->inCache('folder/bar.txt'));
     $this->assertFalse($this->cache->inCache('folder/2bar.txt'));
     $this->assertFalse($this->cache->inCache('folder2/bar.txt'));
     $this->cache->put('folder2', ['size' => 1]);
     // mark as complete
     $cachedData = $this->cache->get('');
     $this->assertEquals(-1, $cachedData['size']);
     $this->scanner->scan('', \OC\Files\Cache\Scanner::SCAN_RECURSIVE_INCOMPLETE, \OC\Files\Cache\Scanner::REUSE_ETAG | \OC\Files\Cache\Scanner::REUSE_SIZE);
     $this->assertTrue($this->cache->inCache('folder/bar.txt'));
     $this->assertTrue($this->cache->inCache('folder/bar.txt'));
     $this->assertFalse($this->cache->inCache('folder2/bar.txt'));
     $cachedData = $this->cache->get('');
     $this->assertNotEquals(-1, $cachedData['size']);
     $this->assertFalse($this->cache->getIncomplete());
 }
開發者ID:rchicoli,項目名稱:owncloud-core,代碼行數:21,代碼來源:ScannerTest.php

示例7: backgroundScan

 /**
  * walk over any folders that are not fully scanned yet and scan them
  */
 public function backgroundScan()
 {
     $lastPath = null;
     while (($path = $this->cache->getIncomplete()) !== false && $path !== $lastPath) {
         try {
             $this->scan($path, self::SCAN_RECURSIVE, self::REUSE_ETAG);
             \OC_Hook::emit('Scanner', 'correctFolderSize', array('path' => $path));
             if ($this->cacheActive) {
                 $this->cache->correctFolderSize($path);
             }
         } catch (\OCP\Files\StorageInvalidException $e) {
             // skip unavailable storages
         } catch (\OCP\Files\StorageNotAvailableException $e) {
             // skip unavailable storages
         } catch (\OCP\Lock\LockedException $e) {
             // skip unavailable storages
         }
         // FIXME: this won't proceed with the next item, needs revamping of getIncomplete()
         // to make this possible
         $lastPath = $path;
     }
 }
開發者ID:ElAutoestopista,項目名稱:core,代碼行數:25,代碼來源:scanner.php

示例8: getIncomplete

 /**
  * find a folder in the cache which has not been fully scanned
  *
  * If multiple incomplete folders are in the cache, the one with the highest id will be returned,
  * use the one with the highest id gives the best result with the background scanner, since that is most
  * likely the folder where we stopped scanning previously
  *
  * @return string|bool the path of the folder or false when no folder matched
  */
 public function getIncomplete()
 {
     return $this->cache->getIncomplete();
 }
開發者ID:kebenxiaoming,項目名稱:owncloudRedis,代碼行數:13,代碼來源:cachewrapper.php


注:本文中的OC\Files\Cache\Cache::getIncomplete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。