Composer API
Class

Composer\Cache

class Cache

Reads/writes to a filesystem cache

Methods

__construct(IOInterface $io, string $cacheDir, string $whitelist = 'a-z0-9.', Filesystem $filesystem = null)

isEnabled()

getRoot()

read($file)

write($file, $contents)

copyFrom($file, $source)

Copy a file into the cache

copyTo($file, $target)

Copy a file out of the cache

gcIsNecessary()

remove($file)

clear()

gc($ttl, $maxSize)

sha1($file)

sha256($file)

Details

at line 40
public __construct(IOInterface $io, string $cacheDir, string $whitelist = 'a-z0-9.', Filesystem $filesystem = null)

Parameters

IOInterface $io
string $cacheDir location of the cache
string $whitelist List of characters that are allowed in path names (used in a regex character class)
Filesystem $filesystem optional filesystem instance

at line 62
public isEnabled()

at line 67
public getRoot()

at line 72
public read($file)

Parameters

$file

at line 84
public write($file, $contents)

Parameters

$file
$contents

at line 122
public copyFrom($file, $source)

Copy a file into the cache

Parameters

$file
$source

at line 143
public copyTo($file, $target)

Copy a file out of the cache

Parameters

$file
$target

at line 163
public gcIsNecessary()

at line 168
public remove($file)

Parameters

$file

at line 178
public clear()

at line 187
public gc($ttl, $maxSize)

Parameters

$ttl
$maxSize

at line 217
public sha1($file)

Parameters

$file

at line 227
public sha256($file)

Parameters

$file