## Class TDirectoryCacheDependency

Description

TDirectoryCacheDependency class.

TDirectoryCacheDependency performs dependency checking based on the modification time of the files contained in the specified directory. The directory being checked is specified via 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 RecursiveCheck and RecursiveLevel, one can limit the checking to a certain depth of the subdirectories.

- since: 3.1.0
- version: $Id: TCache.php 1565 2006-12-05 20:38:18Z xue $
- author: Qiang Xue <qiang.xue@gmail.com>

Located in /Caching/TCache.php (line 351)

    TComponent
       |
       --TCacheDependency
          |
          --TDirectoryCacheDependency

Method Summary
TDirectoryCacheDependency __construct (string $directory)
array generateTimestamps (string $directory, int $level)
string getDirectory ()
boolean getHasChanged ()
boolean getRecursiveCheck ()
int getRecursiveLevel ()
void setDirectory (string $directory)
void setRecursiveCheck (boolean $value)
void setRecursiveLevel (int $value)
boolean validateDirectory (string $directory)
boolean validateFile (string $fileName)
Methods
Constructor __construct (line 362)

Constructor.

- access: public

TDirectoryCacheDependency __construct (string $directory)

- string $directory: the directory to be checked

generateTimestamps (line 470)

Determines the last modification time for files under the directory.

This method may go recurisvely into subdirectories if RecursiveCheck is set true.

- return: list of file modification time indexed by the file path
- access: protected

array generateTimestamps (string $directory, int $level)

- string $directory: the directory name
- int $level: level of the recursion

getDirectory (line 370)

- return: the directory to be checked
- access: public

string getDirectory ()
getHasChanged (line 431)

Performs the actual dependency checking.

This method returns true if the directory is changed.

- return: whether the dependency is changed or not.
- access: public

boolean getHasChanged ()
getRecursiveCheck (line 391)

- return: whether the subdirectories of the directory will also be checked. It defaults to true.
- access: public

boolean getRecursiveCheck ()
getRecursiveLevel (line 408)

- return: the depth of the subdirectories to be checked. It defaults to -1, meaning unlimited depth.
- access: public

int getRecursiveLevel ()
setDirectory (line 379)

- access: public
- throws: TInvalidDataValueException if the directory does not exist

void setDirectory (string $directory)

- string $directory: the directory to be checked

setRecursiveCheck (line 399)

- access: public

void setRecursiveCheck (boolean $value)

- boolean $value: whether the subdirectories of the directory will also be checked.

setRecursiveLevel (line 421)

Sets a value indicating the depth of the subdirectories to be checked.

This is meaningful only when RecursiveCheck is true.

- access: public

void setRecursiveLevel (int $value)

- int $value: the depth of the subdirectories to be 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.

validateDirectory (line 457)

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.

- return: whether this subdirectory should be checked.
- access: protected

boolean validateDirectory (string $directory)

- string $directory: the name of the subdirectory that may be checked for dependency.

validateFile (line 444)

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.

- return: whether this file should be checked.
- access: protected

boolean validateFile (string $fileName)

- string $fileName: the name of the file that may be checked for dependency.

#### Inherited Methods

Inherited From TComponent

> TComponent::addParsedObject()
> TComponent::attachEventHandler()
> TComponent::canGetProperty()
> TComponent::canSetProperty()
> TComponent::createdOnTemplate()
> TComponent::detachEventHandler()
> TComponent::evaluateExpression()
> TComponent::evaluateStatements()
> TComponent::getEventHandlers()
> TComponent::getSubProperty()
> TComponent::hasEvent()
> TComponent::hasEventHandler()
> TComponent::hasProperty()
> TComponent::raiseEvent()
> TComponent::setSubProperty()
> TComponent::__get()
> TComponent::__set()

Documentation generated on Sun, 14 Jan 2007 21:41:22 -0500 by phpDocumentor 1.3.0RC4