ultimix

- Main Page
- Data Structures
- Files
- Examples

- Data Structures
- Data Structure Index
- Data Fields

Public Member Functions | Data Fields
cached_fs_1_0_0 Class Reference

## Public Member Functions
| cached_fs_1_0_0 ()
| reset ()
| store_file_exists_info ($OriginalFilePath, $ExistsFlag)
| file_exists ($OriginalFilePath)
| file_get_contents ($OriginalFilePath)
| file_put_contents ($OriginalFilePath, $Data)
| flush ()

## Data Fields
| $MountedStorages = false
| $Cache

## Detailed Description

Class provides virtual FS manipulation routine.

Author
  Dodonov A.A.

Definition at line 26 of file cached_fs.php.

## Member Function Documentation

cached_fs_1_0_0 | ( |  | ) |

Constructor.

Exceptions

  Exception | - An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 66 of file cached_fs.php.

{
try
{
$this->Cache = get_package( 'cache' , 'last' , __FILE__ );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

file_exists | ( |  | $OriginalFilePath | ) |

Function validates if the file exists.

Parameters

  $OriginalFilePath | - Path to the requesting file.

Returns
  true if the file exists, otherwise false.

Exceptions

  Exception | - An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 172 of file cached_fs.php.

{
try
{
$OriginalFilePath = str_replace( '/./' , '/' , $OriginalFilePath );
$Data = $this->Cache->get_data( $OriginalFilePath );
if( $Data === false )
{
return( $this->store_file_exists_info( $OriginalFilePath , file_exists( $OriginalFilePath ) ) );
}
else
{
return( $Data == '_file_was_not_found' ? false : true );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

file_get_contents | ( |  | $OriginalFilePath | ) |

Cached input from file.

Parameters

  $OriginalFilePath | path to the requesting file.

Returns
  File's content.

Exceptions

  Exception | - An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 216 of file cached_fs.php.

{
try
{
$OriginalFilePath = str_replace( '/./' , '/' , $OriginalFilePath );
$Data = $this->Cache->get_data( $OriginalFilePath );
if( $Data !== false )
{
return( $Data );
}
else
{
$Data = @file_get_contents( $OriginalFilePath );
if( $Data !== false )
{
$this->Cache->add_data( $OriginalFilePath , $Data );
return( $Data );
}
else
{
throw( new Exception( "File $OriginalFilePath was not found" ) );
}
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

file_put_contents | ( |  | $OriginalFilePath,
|  |  | $Data
| ) |  |

Cached input from file.

Parameters

  $OriginalFilePath | path to the requesting file.
  Data | - File's content to store.

Exceptions

  Exception | - An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 268 of file cached_fs.php.

{
try
{
$OriginalFilePath = str_replace( '/./' , '/' , $OriginalFilePath );
if( $this->Cache->data_exists( $OriginalFilePath ) )
{
$this->Cache->set_data( $OriginalFilePath , $Data );
}
else
{
$this->Cache->add_data( $OriginalFilePath , $Data );
}
@file_put_contents( $OriginalFilePath , $Data );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

flush | ( |  | ) |

Function flushes all data on disk.

Exceptions

  Exception | - An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 304 of file cached_fs.php.

{
try
{
$this->Cache->flush();
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

reset | ( |  | ) |

Function resets settings.

Exceptions

  Exception | - An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 92 of file cached_fs.php.

{
try
{
$this->Cache->reset();
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

store_file_exists_info | ( |  | $OriginalFilePath,
|  |  | $ExistsFlag
| ) |  |

Function stores info if the file exists.

Parameters

  $OriginalFilePath | - Path to the requesting file.
  $ExistsFlag | - Информация о существовании.

Returns
  true if the file exists, otherwise false.

Exceptions

  Exception | - An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 130 of file cached_fs.php.

{
try
{
if( $ExistsFlag !== false )
{
return( true );
}
else
{
$this->Cache->add_data( $OriginalFilePath , '_file_was_not_found' );
return( false );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

## Field Documentation

$Cache

Cache.

Author
  Dodonov A.A.

Definition at line 50 of file cached_fs.php.

$MountedStorages = false

List of the mounted storages.

Author
  Dodonov A.A.

Definition at line 38 of file cached_fs.php.

The documentation for this class was generated from the following file:

- packages/cached_fs/cached_fs.php