CacheWrapper

class OC\Files\Cache\Wrapper\CacheWrapper
Source:lib/private/Files/Cache/Wrapper/CacheWrapper.php#38
Parent:OC\Files\Cache\Cache

Properties

protected static property OC\Files\Cache\Wrapper\CacheWrapper::$cache
Source:lib/private/Files/Cache/Wrapper/CacheWrapper.php#42
Type:\OCP\Files\Cache\ICache

Methods

public OC\Files\Cache\Wrapper\CacheWrapper::__construct($cache)
Source:

lib/private/Files/Cache/Wrapper/CacheWrapper.php#47

Parameters:
protected OC\Files\Cache\Wrapper\CacheWrapper::getCache()
Source:lib/private/Files/Cache/Wrapper/CacheWrapper.php#51
protected OC\Files\Cache\Wrapper\CacheWrapper::formatCacheEntry($entry)
Make it easy for wrappers to modify every returned cache entry
Source:

lib/private/Files/Cache/Wrapper/CacheWrapper.php#61

Parameters:
Returns:

\OCP\Files\Cache\ICacheEntry

public OC\Files\Cache\Wrapper\CacheWrapper::get($file)
get the stored metadata of a file or folder
Source:

lib/private/Files/Cache/Wrapper/CacheWrapper.php#71

Parameters:
  • $file (string | int)
Returns:

\OCP\Files\Cache\ICacheEntry | bool

public OC\Files\Cache\Wrapper\CacheWrapper::getFolderContents($folder)
get the metadata of all files stored in $folder
Source:

lib/private/Files/Cache/Wrapper/CacheWrapper.php#85

Parameters:
  • $folder (string)
Returns:

\OCP\Files\Cache\ICacheEntry[]

public OC\Files\Cache\Wrapper\CacheWrapper::getFolderContentsById($fileId)
get the metadata of all files stored in $folder
Source:

lib/private/Files/Cache/Wrapper/CacheWrapper.php#98

Parameters:
  • $fileId (int) the file id of the folder
Returns:

array

public OC\Files\Cache\Wrapper\CacheWrapper::put($file, $data)
insert or update meta data for a file or folder
Source:

lib/private/Files/Cache/Wrapper/CacheWrapper.php#112

Parameters:
  • $file (string)
  • $data (array)
Returns:

int file id

Throws:

\RuntimeException

public OC\Files\Cache\Wrapper\CacheWrapper::insert($file, $data)
insert meta data for a new file or folder
Source:

lib/private/Files/Cache/Wrapper/CacheWrapper.php#130

Parameters:
  • $file (string)
  • $data (array)
Returns:

int file id

Throws:

\RuntimeException

public OC\Files\Cache\Wrapper\CacheWrapper::update($id, $data)
update the metadata in the cache
Source:

lib/private/Files/Cache/Wrapper/CacheWrapper.php#140

Parameters:
  • $id (int)
  • $data (array)
public OC\Files\Cache\Wrapper\CacheWrapper::getId($file)
get the file id for a file
Source:

lib/private/Files/Cache/Wrapper/CacheWrapper.php#150

Parameters:
  • $file (string)
Returns:

int

public OC\Files\Cache\Wrapper\CacheWrapper::getParentId($file)
get the id of the parent folder of a file
Source:

lib/private/Files/Cache/Wrapper/CacheWrapper.php#160

Parameters:
  • $file (string)
Returns:

int

public OC\Files\Cache\Wrapper\CacheWrapper::inCache($file)
check if a file is available in the cache
Source:

lib/private/Files/Cache/Wrapper/CacheWrapper.php#170

Parameters:
  • $file (string)
Returns:

bool

public OC\Files\Cache\Wrapper\CacheWrapper::remove($file)
remove a file or folder from the cache
Source:

lib/private/Files/Cache/Wrapper/CacheWrapper.php#179

Parameters:
  • $file (string)
public OC\Files\Cache\Wrapper\CacheWrapper::move($source, $target)
Move a file or folder in the cache
Source:

lib/private/Files/Cache/Wrapper/CacheWrapper.php#189

Parameters:
  • $source (string)
  • $target (string)
protected OC\Files\Cache\Wrapper\CacheWrapper::getMoveInfo($path)
Source:lib/private/Files/Cache/Wrapper/CacheWrapper.php#193
public OC\Files\Cache\Wrapper\CacheWrapper::moveFromCache($sourceCache, $sourcePath, $targetPath)
Source:lib/private/Files/Cache/Wrapper/CacheWrapper.php#199
public OC\Files\Cache\Wrapper\CacheWrapper::clear()
remove all entries for files that are stored on the storage from the cache
Source:lib/private/Files/Cache/Wrapper/CacheWrapper.php#206
public OC\Files\Cache\Wrapper\CacheWrapper::getStatus($file)
Source:

lib/private/Files/Cache/Wrapper/CacheWrapper.php#215

Parameters:
  • $file (string)
Returns:

int Cache::NOT_FOUND, Cache::PARTIAL, Cache::SHALLOW or Cache::COMPLETE

public OC\Files\Cache\Wrapper\CacheWrapper::search($pattern)
search for files matching $pattern
Source:

lib/private/Files/Cache/Wrapper/CacheWrapper.php#225

Parameters:
  • $pattern (string)
Returns:

\OCP\Files\Cache\ICacheEntry[] an array of file data

public OC\Files\Cache\Wrapper\CacheWrapper::searchByMime($mimetype)
search for files by mimetype
Source:

lib/private/Files/Cache/Wrapper/CacheWrapper.php#236

Parameters:
  • $mimetype (string)
Returns:

\OCP\Files\Cache\ICacheEntry[]

public OC\Files\Cache\Wrapper\CacheWrapper::searchQuery($query)
Source:lib/private/Files/Cache/Wrapper/CacheWrapper.php#241
public OC\Files\Cache\Wrapper\CacheWrapper::correctFolderSize($path, $data=null, $isBackgroundScan=false)
update the folder size and the size of all parent folders
Source:

lib/private/Files/Cache/Wrapper/CacheWrapper.php#252

Parameters:
  • $path (string | bool)
  • $data (array) (optional) meta data of the folder
public OC\Files\Cache\Wrapper\CacheWrapper::calculateFolderSize($path, $entry=null)
get the size of a folder and set it in the cache
Source:

lib/private/Files/Cache/Wrapper/CacheWrapper.php#265

Parameters:
  • $path (string)
  • $entry (array) (optional) meta data of the folder
Returns:

int

public OC\Files\Cache\Wrapper\CacheWrapper::getAll()
get all file ids on the files on the storage
Source:lib/private/Files/Cache/Wrapper/CacheWrapper.php#278
Returns:int[]
public OC\Files\Cache\Wrapper\CacheWrapper::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
Source:lib/private/Files/Cache/Wrapper/CacheWrapper.php#291
Returns:string | bool the path of the folder or false when no folder matched
public OC\Files\Cache\Wrapper\CacheWrapper::getPathById($id)
get the path of a file on this storage by it’s id
Source:

lib/private/Files/Cache/Wrapper/CacheWrapper.php#301

Parameters:
  • $id (int)
Returns:

string | null

public OC\Files\Cache\Wrapper\CacheWrapper::getNumericStorageId()
Returns the numeric storage id
Source:lib/private/Files/Cache/Wrapper/CacheWrapper.php#310
Returns:int
public static OC\Files\Cache\Wrapper\CacheWrapper::getById($id)
get the storage id of the storage for a file and the internal path of the file
unlike getPathById this does not limit the search to files on this storage and
instead does a global search in the cache table
Source:

lib/private/Files/Cache/Wrapper/CacheWrapper.php#322

Parameters:
  • $id (int)
Returns:

array first element holding the storage id, second the path