Class CDirectoryCacheDependency
CDirectoryCacheDependency represents a dependency based on change of a directory.
CDirectoryCacheDependency performs dependency checking based on the
modification time of the files contained in the specified directory. The
directory being checked is specified via CDirectoryCacheDependency::$directory
.
By default, all files under the specified directory and subdirectories will
be checked. If the last modification time of any of them is changed or if
different number of files are contained in a directory, the dependency is
reported as changed. By specifying CDirectoryCacheDependency::$recursiveLevel
, one can limit the
checking to a certain depth of the directory.
Note, dependency checking for a directory is expensive because it involves accessing modification time of multiple files under the directory.
- CComponent
- CCacheDependency implements ICacheDependency
- CDirectoryCacheDependency
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/caching/dependencies/CDirectoryCacheDependency.php
public
|
|
protected
mixed
|
#
generateDependentData( )
Generates the data needed to determine if dependency has been changed. This method returns the modification timestamps for files under the directory. |
protected
array
|
#
generateTimestamps( string $directory, integer $level = 0 )
Determines the last modification time for files under the directory. This
method may go recursively into subdirectories if |
protected
boolean
|
#
validateFile( string $fileName )
Checks to see if the file should be checked for dependency. This method is invoked when dependency of the whole directory is being checked. By default, it always returns true, meaning the file should be checked. You may override this method to check only certain files. |
protected
boolean
|
#
validateDirectory( string $directory )
Checks to see if the specified subdirectory should be checked for dependency. This method is invoked when dependency of the whole directory is being checked. By default, it always returns true, meaning the subdirectory should be checked. You may override this method to check only certain subdirectories. |
evaluateDependency(),
getDependentData(),
getHasChanged(),
resetReusableData()
|
public
string
|
$directory |
|
#
the directory whose change is used to determine if the dependency has been changed. If any of the files under the directory is changed, the dependency is considered as changed. |
public
integer
|
$recursiveLevel | -1 |
#
the depth of the subdirectories to be recursively checked. If the value is less than 0, it means unlimited depth. If the value is 0, it means checking the files directly under the specified directory. |
public
string
|
$namePattern |
|
#
the regular expression matching valid file/directory names. Only the matching files or directories will be checked for changes. Defaults to null, meaning all files/directories will qualify. |
$reuseDependentData
|
$dependentData,
$hasChanged
|