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


PHP Cache::remove方法代码示例

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


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

示例1: removeFromCache

	protected function removeFromCache($path) {
		\OC_Hook::emit('Scanner', 'removeFromCache', array('file' => $path));
		$this->emit('\OC\Files\Cache\Scanner', 'removeFromCache', array($path));
		if ($this->cacheActive) {
			$this->cache->remove($path);
		}
	}
开发者ID:ninjasilicon,项目名称:core,代码行数:7,代码来源:scanner.php

示例2: renameFromStorage

 /**
  * Rename a file or folder in the cache and update the size, etag and mtime of the parent folders
  *
  * @param IStorage $sourceStorage
  * @param string $source
  * @param string $target
  */
 public function renameFromStorage(IStorage $sourceStorage, $source, $target)
 {
     if (!$this->enabled or Scanner::isPartialFile($source) or Scanner::isPartialFile($target)) {
         return;
     }
     $time = time();
     $sourceCache = $sourceStorage->getCache();
     $sourceUpdater = $sourceStorage->getUpdater();
     $sourcePropagator = $sourceStorage->getPropagator();
     if ($sourceCache->inCache($source)) {
         if ($this->cache->inCache($target)) {
             $this->cache->remove($target);
         }
         if ($sourceStorage === $this->storage) {
             $this->cache->move($source, $target);
         } else {
             $this->cache->moveFromCache($sourceCache, $source, $target);
         }
     }
     if (pathinfo($source, PATHINFO_EXTENSION) !== pathinfo($target, PATHINFO_EXTENSION)) {
         // handle mime type change
         $mimeType = $this->storage->getMimeType($target);
         $fileId = $this->cache->getId($target);
         $this->cache->update($fileId, ['mimetype' => $mimeType]);
     }
     $sourceCache->correctFolderSize($source);
     $this->cache->correctFolderSize($target);
     if ($sourceUpdater instanceof Updater) {
         $sourceUpdater->correctParentStorageMtime($source);
     }
     $this->correctParentStorageMtime($target);
     $this->updateStorageMTimeOnly($target);
     $sourcePropagator->propagateChange($source, $time);
     $this->propagator->propagateChange($target, $time);
 }
开发者ID:farukuzun,项目名称:core-1,代码行数:42,代码来源:updater.php

示例3: cleanFolder

 /**
  * remove deleted files in $path from the cache
  *
  * @param string $path
  */
 public function cleanFolder($path)
 {
     $cachedContent = $this->cache->getFolderContents($path);
     foreach ($cachedContent as $entry) {
         if (!$this->storage->file_exists($entry['path'])) {
             $this->cache->remove($entry['path']);
         }
     }
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:14,代码来源:Watcher.php

示例4: testNoReuseOfFileId

	public function testNoReuseOfFileId() {
		$data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain');
		$this->cache->put('somefile.txt', $data1);
		$info = $this->cache->get('somefile.txt');
		$fileId = $info['fileid'];
		$this->cache->remove('somefile.txt');
		$data2 = array('size' => 200, 'mtime' => 100, 'mimetype' => 'text/plain');
		$this->cache->put('anotherfile.txt', $data2);
		$info2 = $this->cache->get('anotherfile.txt');
		$fileId2 = $info2['fileid'];
		$this->assertNotEquals($fileId, $fileId2);
	}
开发者ID:ninjasilicon,项目名称:core,代码行数:12,代码来源:cache.php

示例5: testRootFolderSizeForNonHomeStorage

 public function testRootFolderSizeForNonHomeStorage()
 {
     $dir1 = 'knownsize';
     $dir2 = 'unknownsize';
     $fileData = array();
     $fileData[''] = array('size' => -1, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory');
     $fileData[$dir1] = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'httpd/unix-directory');
     $fileData[$dir2] = array('size' => -1, 'mtime' => 25, 'mimetype' => 'httpd/unix-directory');
     $this->cache->put('', $fileData['']);
     $this->cache->put($dir1, $fileData[$dir1]);
     $this->cache->put($dir2, $fileData[$dir2]);
     $this->assertTrue($this->cache->inCache($dir1));
     $this->assertTrue($this->cache->inCache($dir2));
     // check that root size ignored the unknown sizes
     $this->assertEquals(-1, $this->cache->calculateFolderSize(''));
     // clean up
     $this->cache->remove('');
     $this->cache->remove($dir1);
     $this->cache->remove($dir2);
     $this->assertFalse($this->cache->inCache($dir1));
     $this->assertFalse($this->cache->inCache($dir2));
 }
开发者ID:Romua1d,项目名称:core,代码行数:22,代码来源:cache.php

示例6: testEscaping

 /**
  * @param string $name
  * @dataProvider escapingProvider
  */
 public function testEscaping($name)
 {
     $data = array('size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain');
     $this->cache->put($name, $data);
     $this->assertTrue($this->cache->inCache($name));
     $retrievedData = $this->cache->get($name);
     foreach ($data as $key => $value) {
         $this->assertEquals($value, $retrievedData[$key]);
     }
     $this->cache->move($name, $name . 'asd');
     $this->assertFalse($this->cache->inCache($name));
     $this->assertTrue($this->cache->inCache($name . 'asd'));
     $this->cache->remove($name . 'asd');
     $this->assertFalse($this->cache->inCache($name . 'asd'));
     $folderData = array('size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory');
     $this->cache->put($name, $folderData);
     $this->cache->put('other', $folderData);
     $childs = ['asd', 'bar', 'foo', 'sub/folder'];
     $this->cache->put($name . '/sub', $folderData);
     $this->cache->put('other/sub', $folderData);
     foreach ($childs as $child) {
         $this->cache->put($name . '/' . $child, $data);
         $this->cache->put('other/' . $child, $data);
         $this->assertTrue($this->cache->inCache($name . '/' . $child));
     }
     $this->cache->move($name, $name . 'asd');
     foreach ($childs as $child) {
         $this->assertTrue($this->cache->inCache($name . 'asd/' . $child));
         $this->assertTrue($this->cache->inCache('other/' . $child));
     }
     foreach ($childs as $child) {
         $this->cache->remove($name . 'asd/' . $child);
         $this->assertFalse($this->cache->inCache($name . 'asd/' . $child));
         $this->assertTrue($this->cache->inCache('other/' . $child));
     }
 }
开发者ID:farukuzun,项目名称:core-1,代码行数:40,代码来源:cache.php

示例7: scanChildren

 /**
  * scan all the files and folders in a folder
  *
  * @param string $path
  * @param bool $recursive
  * @param int $reuse
  * @return int the size of the scanned folder or -1 if the size is unknown at this stage
  */
 public function scanChildren($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1)
 {
     if ($reuse === -1) {
         $reuse = $recursive === self::SCAN_SHALLOW ? self::REUSE_ETAG | self::REUSE_SIZE : 0;
     }
     $this->emit('\\OC\\Files\\Cache\\Scanner', 'scanFolder', array($path, $this->storageId));
     $size = 0;
     $childQueue = array();
     $existingChildren = array();
     if ($this->cache->inCache($path)) {
         $children = $this->cache->getFolderContents($path);
         foreach ($children as $child) {
             $existingChildren[] = $child['name'];
         }
     }
     $newChildren = array();
     if ($this->storage->is_dir($path) && ($dh = $this->storage->opendir($path))) {
         $exceptionOccurred = false;
         \OC_DB::beginTransaction();
         if (is_resource($dh)) {
             while (($file = readdir($dh)) !== false) {
                 $child = $path ? $path . '/' . $file : $file;
                 if (!Filesystem::isIgnoredDir($file)) {
                     $newChildren[] = $file;
                     try {
                         $data = $this->scanFile($child, $reuse, true);
                         if ($data) {
                             if ($data['size'] === -1) {
                                 if ($recursive === self::SCAN_RECURSIVE) {
                                     $childQueue[] = $child;
                                 } else {
                                     $size = -1;
                                 }
                             } else {
                                 if ($size !== -1) {
                                     $size += $data['size'];
                                 }
                             }
                         }
                     } catch (\Doctrine\DBAL\DBALException $ex) {
                         // might happen if inserting duplicate while a scanning
                         // process is running in parallel
                         // log and ignore
                         \OC_Log::write('core', 'Exception while scanning file "' . $child . '": ' . $ex->getMessage(), \OC_Log::DEBUG);
                         $exceptionOccurred = true;
                     }
                 }
             }
         }
         $removedChildren = \array_diff($existingChildren, $newChildren);
         foreach ($removedChildren as $childName) {
             $child = $path ? $path . '/' . $childName : $childName;
             $this->cache->remove($child);
         }
         \OC_DB::commit();
         if ($exceptionOccurred) {
             // It might happen that the parallel scan process has already
             // inserted mimetypes but those weren't available yet inside the transaction
             // To make sure to have the updated mime types in such cases,
             // we reload them here
             $this->cache->loadMimetypes();
         }
         foreach ($childQueue as $child) {
             $childSize = $this->scanChildren($child, self::SCAN_RECURSIVE, $reuse);
             if ($childSize === -1) {
                 $size = -1;
             } else {
                 $size += $childSize;
             }
         }
         $this->cache->put($path, array('size' => $size));
     }
     $this->emit('\\OC\\Files\\Cache\\Scanner', 'postScanFolder', array($path, $this->storageId));
     return $size;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:83,代码来源:scanner.php

示例8: remove

 /**
  * remove a file or folder from the cache
  *
  * @param string $file
  */
 public function remove($file)
 {
     $this->cache->remove($file);
 }
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:9,代码来源:cachewrapper.php


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