\Pydio\Core\ServicesLocalCache

Generic caching system that can be used by the plugins. Use the static factory getItem() to generate a actual cached instance.

Summary

Methods
Properties
Constants
getItem()
simpleCopy()
clearItem()
__construct()
getData()
writeable()
getId()
hasCachedVersion()
touch()
No public properties found
No constants found
buildCacheId()
$cacheDir
$cacheId
$masterFile
$dataCallback
$idComputerCallback
N/A
No private methods found
No private properties found
N/A

Properties

$cacheDir

$cacheDir : 

Type

$cacheId

$cacheId : 

Type

$masterFile

$masterFile : 

Type

$dataCallback

$dataCallback : 

Type

$idComputerCallback

$idComputerCallback : 

Type

Methods

getItem()

getItem(string  $pluginId, string  $filepath, callable  $dataCallback = null, string  $idComputerCallback = null) : \Pydio\Core\Services\LocalCache

Create an LocalCache instance

Parameters

string $pluginId
string $filepath
callable $dataCallback

A function to generate the data cache. If no callback provided, will simply use the content of the master item as the cache data

string $idComputerCallback

A function to generate the ID of the cache. If not provided, will generate a random hash

Returns

\Pydio\Core\Services\LocalCache

simpleCopy()

simpleCopy(string  $master, string  $target) : void

The default dataCallback

Parameters

string $master
string $target

clearItem()

clearItem(String  $pluginId, String  $filepath) : void

Clear a cache item associated with the master filepath

Parameters

String $pluginId
String $filepath

__construct()

__construct(  $pluginId,   $filepath,   $dataCallback, null  $idComputerCallback = NULL) 

Actual Cache object. Should not be used directly, but via the factory static method getItem()

Parameters

$pluginId
$filepath
$dataCallback
null $idComputerCallback

getData()

getData() : string

Load the actual data, either from the cache or from the master, and save it in the cache if necessary.

Returns

string

writeable()

writeable() : boolean

Check if the cache dir is writeable

Returns

boolean

getId()

getId() : string

The unique ID of the item

Returns

string

hasCachedVersion()

hasCachedVersion() : boolean

Check whether a cached version of the master file exists or not

Returns

boolean

touch()

touch() : void

Refresh the cached version modif date to the master modif date

buildCacheId()

buildCacheId(  $pluginId,   $filePath) : string

Generate an ID for the cached file, either using the idComputerCallback, or a simple hash function.

Parameters

$pluginId
$filePath

Returns

string