PHP Class ElggFileCache, Elgg

Inheritance: extends ElggCache
Show file Open project: elgg/elgg Class Usage Examples

Public Methods

Method Description
__construct ( string $cache_path, integer $max_age, integer $max_size ) Set the Elgg cache.
__destruct ( ) Preform cleanup and invalidates cache upon object destruction
clear ( ) : void Delete all files in the directory of this file cache
delete ( string $key ) : boolean Invalidate a given key.
load ( string $key, integer $offset, integer $limit = null ) : string Load a key
save ( string $key, string $data ) : boolean Save a key

Protected Methods

Method Description
createFile ( string $filename, string $rw = "rb" ) : mixed Create and return a handle to a file.
sanitizeFilename ( string $key ) : string Create a sanitised filename for the file.

Method Details

__construct() public method

Set the Elgg cache.
public __construct ( string $cache_path, integer $max_age, integer $max_size )
$cache_path string The cache path.
$max_age integer Maximum age in seconds, 0 if no limit.
$max_size integer Maximum size of cache in seconds, 0 if no limit.

__destruct() public method

Preform cleanup and invalidates cache upon object destruction
public __destruct ( )

clear() public method

Delete all files in the directory of this file cache
public clear ( ) : void
return void

createFile() protected method

Create and return a handle to a file.
protected createFile ( string $filename, string $rw = "rb" ) : mixed
$filename string Filename to save as
$rw string Write mode
return mixed

delete() public method

Invalidate a given key.
public delete ( string $key ) : boolean
$key string Name
return boolean

load() public method

Load a key
public load ( string $key, integer $offset, integer $limit = null ) : string
$key string Name
$offset integer Offset
$limit integer Limit
return string

sanitizeFilename() protected method

Create a sanitised filename for the file.
protected sanitizeFilename ( string $key ) : string
$key string The filename
return string

save() public method

Save a key
public save ( string $key, string $data ) : boolean
$key string Name
$data string Value
return boolean