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


PHP Cache::getParentId方法代码示例

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


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

示例1: correctParentStorageMtime

 /**
  * update the storage_mtime of the direct parent in the cache to the mtime from the storage
  *
  * @param string $internalPath
  */
 private function correctParentStorageMtime($internalPath)
 {
     $parentId = $this->cache->getParentId($internalPath);
     $parent = dirname($internalPath);
     if ($parentId != -1) {
         $this->cache->update($parentId, array('storage_mtime' => $this->storage->filemtime($parent)));
     }
 }
开发者ID:farukuzun,项目名称:core-1,代码行数:13,代码来源:updater.php

示例2: testSimple

	public function testSimple() {
		$file1 = 'foo';
		$file2 = 'foo/bar';
		$data1 = array('size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder');
		$data2 = array('size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file');

		$this->assertFalse($this->cache->inCache($file1));
		$this->assertEquals($this->cache->get($file1), null);

		$id1 = $this->cache->put($file1, $data1);
		$this->assertTrue($this->cache->inCache($file1));
		$cacheData1 = $this->cache->get($file1);
		foreach ($data1 as $key => $value) {
			$this->assertEquals($value, $cacheData1[$key]);
		}
		$this->assertEquals($cacheData1['mimepart'], 'foo');
		$this->assertEquals($cacheData1['fileid'], $id1);
		$this->assertEquals($id1, $this->cache->getId($file1));

		$this->assertFalse($this->cache->inCache($file2));
		$id2 = $this->cache->put($file2, $data2);
		$this->assertTrue($this->cache->inCache($file2));
		$cacheData2 = $this->cache->get($file2);
		foreach ($data2 as $key => $value) {
			$this->assertEquals($value, $cacheData2[$key]);
		}
		$this->assertEquals($cacheData1['fileid'], $cacheData2['parent']);
		$this->assertEquals($cacheData2['fileid'], $id2);
		$this->assertEquals($id2, $this->cache->getId($file2));
		$this->assertEquals($id1, $this->cache->getParentId($file2));

		$newSize = 1050;
		$newId2 = $this->cache->put($file2, array('size' => $newSize));
		$cacheData2 = $this->cache->get($file2);
		$this->assertEquals($newId2, $id2);
		$this->assertEquals($cacheData2['size'], $newSize);
		$this->assertEquals($cacheData1, $this->cache->get($file1));

		$this->cache->remove($file2);
		$this->assertFalse($this->cache->inCache($file2));
		$this->assertEquals($this->cache->get($file2), null);
		$this->assertTrue($this->cache->inCache($file1));

		$this->assertEquals($cacheData1, $this->cache->get($id1));
	}
开发者ID:ninjasilicon,项目名称:core,代码行数:45,代码来源:cache.php

示例3: getParentId

 /**
  * get the id of the parent folder of a file
  *
  * @param string $file
  * @return int
  */
 public function getParentId($file)
 {
     return $this->cache->getParentId($file);
 }
开发者ID:kebenxiaoming,项目名称:owncloudRedis,代码行数:10,代码来源:cachewrapper.php


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