public
|
|
public
mixed
|
#
get( string $file, callable $constructor, mixed $userdata = null )
Check if a file exists in the repository.
Check if a file exists in the repository.
If the file does not exists, it's created using the provided constructor.
The working directory is changed to the repository during the process.
Parameters
- $file
string $file The name of the file in the repository.
- $constructor
callable $constructor The constructor for the file. The constructor is called with the
cache object, the name of the file and the userdata.
- $userdata
mixed $userdata Userdata that will be passed to the constructor.
Returns
mixed The URL of the file. FALSE is the file failed to be created.
|
public
|
|
public
mixed
|
#
load( string $key, callable $constructor, mixed $userdata = null )
Load cached contents.
If the content is not cached, the constructor is called to create the
content. The content generated by the constructor is save to the cache.
Parameters
- $key
string $key Key for the value in the cache.
- $constructor
callable $constructor Constructor callback. The constructor is called to generated the
contents of the file. The constructor is called with the FileCache object, the
@file and the @userdata as arguments.
- $userdata
mixed $userdata User data that is passed as is to the constructor.
Returns
mixed The contents of the file
|
protected
integer
|
#
save( mixed $file, mixed $contents )
Save contents to a cached file.
Save contents to a cached file.
Parameters
- $file
mixed $file string Name of the file.
- $contents
mixed $contents mixed The contents to write.
Returns
integer Return value from @file_put_contents()
|
public
|
#
store( mixed $key, mixed $data )
|
public
|
|
public
|
|
protected
unknown_type
|
#
read( )
Read to repository and return an array of files.
Read to repository and return an array of files.
Each entry in the array is made up using the _ctime_ and _size_ of the file.
The key of the entry is the file name.
Returns
unknown_type
|
protected
|
|
public
|
#
clear( )
Clear all the files in the repository.
|
public
|
#
clean( )
Clean the repository according to the size and time rules.
|