Class file
Manages file-system based caching.
Metadata is stored at the beginning of each cache file with the following data fields. See $seekOffset to skip to the cache entry data:
Timestamp of last modification (32-bit unsigned integer, little-endian),
time to live in seconds (32-bit unsigned integer, little-endian),
MD5 hash of file contents (16 bytes).
Implementations should however not rely on the format of stream headers and use the access methods provided by this driver.
- Core\Object implements Core\Chainable
- Core\Set implements Core\Accessor
- Core\Cache
- Core\Cache\Driver\file
Package: Core\Cache
Since: 3.0
Requires: PHP 5.3
Version: 1.1
Located at Cache/Driver/file.inc.php
Methods summary
public
|
|
public
boolean
|
|
public
string
|
|
public
string
|
#
getHash( string $class, string $key )
Returns the hash for the requested cache entry. The hash type depends on the backend in use and defaults to 16-byte binary MD5. |
public
|
#
getStream( string $class, string $key )
Returns a reading stream instance for the requested cache entry. |
public
integer
|
#
getTimestamp( string $class, string $key )
Returns a UNIX timestamp of the last cache entry modification. |
public
|
#
put( string $class, string $key, string $binaryData, integer $ttl =
Writes binary data to a specified cache entry. |
public
|
#
putStream( string $class, string $key, integer $ttl =
Returns a writing stream instance for the requested cache entry. |
public
|
#
remove( string $class, string $key )
Deletes a cache key entry. If the entry does not exist, no operation is performed. |
public
string
|
#
targetFile( string $class, string $key, boolean $initClassPath = false )
Computes the cache target file name. |
Methods inherited from Core\Cache
activate()
,
active()
,
autocreate()
,
defaultInstance()
,
getAge()
,
getMeta()
,
getVar()
,
putVar()
,
setVersionID()
,
unify()
Methods inherited from Core\Object
__autocreateFactory()
,
__call()
,
__processParameters()
,
__toString()
,
attachMethod()
,
chain()
,
getValueForKey()
,
getValueForKeyPath()
,
getValueForUndefinedKey()
,
hash()
,
issetValueForKey()
,
setValueForKey()
,
setValueForKeyPath()
,
setValueForUndefinedKey()
,
uuid()
Constants summary
string |
SubdirectoryCharactersParameter
Sets the number of key characters used for subdirectory levels. Only used if a subdirectory level >0 is defined. Default value is 2, maximum allowed value is 3 (minimum is 1). |
#
'sub-chars'
|
string |
SubdirectoryLevelParameter
Controls the number of subdirectories created for cached items. Default value is 0 (no subdirectories are created). Maximum allowed value is 8. |
#
'sub-level'
|
string |
SubdirectoryModeParameter
Default directory mode used for subdirectories. Defaults to 0777. |
#
'sub-mode'
|
Constants inherited from Core\Cache
Constants inherited from Core\Object
AnyParameterType
,
AutochainParameterType
,
AutocreateParameterType
,
BooleanParameterType
,
CharParameterType
,
EnumParameterType
,
IntegerParameterType
,
RealParameterType
,
StringParameterType
,
UserParameterType
Properties summary
protected
array
|
$_v_parameters
File cache settings array. |
|
protected
string
|
$_v_path
Storage path root directory. |
|
protected
integer
|
$_v_seekOffset
Size of file headers to add to seek to absolute positions in streams. |
#
24
|
Properties inherited from Core\Cache
Magic properties
public read-only
array
|
$parameters
Driver configuration array. |
public read-only
string
|
$path
Storage root for storing cache entries. |
public read-only
integer
|
$seekOffset
Size of file header meta data of stored cache entries. |