PHP Class Nette\Caching\Storages\FileStorage

Inheritance: extends Nette\Object, implements Nette\Caching\IStorage
Show file Open project: nette/caching Class Usage Examples

Public Properties

Property Type Description
$gcProbability probability that the clean() routine is started
$useDirectories boolean

Public Methods

Method Description
__construct ( $dir, Nette\Caching\Storages\IJournal $journal = NULL )
clean ( array $conditions ) : void Removes items from the cache by conditions & garbage collector.
lock ( $key ) : void Prevents item reading and writing. Lock is released by write() or remove().
read ( $key ) : mixed | null Read from cache.
remove ( $key ) : void Removes item from the cache.
write ( $key, $data, array $dp ) : void Writes item into the cache.

Protected Methods

Method Description
getCacheFile ( $key ) : string Returns file name.
readData ( $meta ) : mixed Reads cache data from disk and closes cache file handle.
readMetaAndLock ( $file, $lock ) : array | null Reads cache data from disk.

Private Methods

Method Description
delete ( $file, $handle = NULL ) : void Deletes and closes file.
verify ( $meta ) : boolean Verifies dependencies.

Method Details

__construct() public method

public __construct ( $dir, Nette\Caching\Storages\IJournal $journal = NULL )
$journal Nette\Caching\Storages\IJournal

clean() public method

Removes items from the cache by conditions & garbage collector.
public clean ( array $conditions ) : void
$conditions array
return void

getCacheFile() protected method

Returns file name.
protected getCacheFile ( $key ) : string
return string

lock() public method

Prevents item reading and writing. Lock is released by write() or remove().
public lock ( $key ) : void
return void

read() public method

Read from cache.
public read ( $key ) : mixed | null
return mixed | null

readData() protected method

Reads cache data from disk and closes cache file handle.
protected readData ( $meta ) : mixed
return mixed

readMetaAndLock() protected method

Reads cache data from disk.
protected readMetaAndLock ( $file, $lock ) : array | null
return array | null

remove() public method

Removes item from the cache.
public remove ( $key ) : void
return void

write() public method

Writes item into the cache.
public write ( $key, $data, array $dp ) : void
$dp array
return void

Property Details

$gcProbability public static property

probability that the clean() routine is started
public static $gcProbability

$useDirectories public static property

public static bool $useDirectories
return boolean