Packageindex Classtrees Modulegroups Elementlist Report XML Files

File: /home/inri/public_html/daCode-HEAD/daCode/src/phplib/cache.php3
daCode -

Cache

Cache

This Class will handle all cache system

 

private class Cache

This Class will handle all cache system

daCode http://www.dacode.org/
src/phplib/cache.php3
$Id: cache.php3,v 1.70 2002/05/13 21:34:02 jbcombes Exp $

Depends: Config

 

Public Method Summary

void

Cache()

Class constructor
string

check_box([ string $cache_time ], string $name, [ mixed $options ])

Return contents of cached box when it exists
string

write_box(string $name, mixed $options, string $input)

Writes a box in cache
void

write_html(string $file, string $text)

Writes a full page in cache?
void

delete_files(string $dir, boolean $location, boolean $recurs, boolean $rmdir, boolean $rmtag, string $pattern, string $dirpattern)

Delete cached files
void

delete_htmlfiles(string $dir, [ boolean $recurs, boolean $rmdir, boolean $rmtag, string $pattern, string $dirpattern ])

Mnemonic shorthand
void

delete_boxfiles(string $dir, [ boolean $recurs, boolean $rmdir, boolean $rmtag, string $pattern ])

Mnemonic shorthand
void

delete_obsolete_news(integer $news_id)

Delete outdated cache files for news $news_id

Private Method Summary

integer

box_file_exists(string $file)

Check whether file exists, with a lock mechanism to reduce SQL queries.
void

check_html(string $name)

Return contents of HTML file if it exists
integer

html_file_exists(string $file)

Check whether file exists, with a lock mechanism to reduce SQL queries
void

tag_delete_files(string $dir, boolean $location, boolean $recurs, string $pattern, string $dirpattern)

Tag files for deletion
void

tag_file(string $file, [ boolean $force ])

Creates a tag file

Private Field Summary

boolean

$state

State used in write_html()
integer

$lock_delay

When an HTML file is locked up, wait x seconds
boolean

$mark_outdated

Is set to Config::mark_outdated
unknown

$topdir

Is set to Config::topdir
unknown

$cachedir

Is set to Config::cachedir
unknown

$htmldir

Is set to Config::htmldir
object Db

$db

Db abstraction layer
object Session

$session

Session instance
object Utils

$utils

Utils instance

Public Method Details

Cache

public void Cache( )

  Class constructor

Returns void


check_box

public string check_box( [ string $cache_time ], string $name, [ mixed $options ] )

  Return contents of cached box when it exists

Parameter
string $cache_time = >>"60"<<
validity of the cache (seconds)
string $name
of the box
mixed $options = >>""<<
or array of options.
Returns string

content of the file, void if file does not exist.


write_box

public string write_box( string $name, mixed $options, string $input )

  Writes a box in cache

Parameter
string $name
name of the box
mixed $options
or array of options
string $input
content of box.
Returns string

the input if failed to created cache dir.


write_html

public void write_html( string $file, string $text )

  Writes a full page in cache?

Parameter
string $file
filename
string $text
text to write
Returns void


delete_files

public void delete_files( string $dir, boolean $location, boolean $recurs, boolean $rmdir, boolean $rmtag, string $pattern, string $dirpattern )

  Delete cached files

Parameter
string $dir
directory where are the files to delete
boolean $location
if true, $dir is subdir of htmldir, else of cachedir
boolean $recurs
if true, runs through directories recursively
boolean $rmdir
delete directories?
boolean $rmtag
tag files for deletion?
string $pattern
name pattern of files to delete (english?!?)
string $dirpattern
name pattern of dirss to delete
Returns void


delete_htmlfiles

public void delete_htmlfiles( string $dir, [ boolean $recurs, boolean $rmdir, boolean $rmtag, string $pattern, string $dirpattern ] )

  Mnemonic shorthand

Parameter
string $dir
directory where are the files to delete
boolean $recurs = >>false<<
if true, runs through directories recursively
boolean $rmdir = >>false<<
delete directories?
boolean $rmtag = >>false<<
tag files for deletion?
string $pattern = >>".*"<<
name pattern of files to delete (english?!?)
string $dirpattern = >>""<<
name pattern of dirss to delete
Returns void

See Also delete_files()

delete_boxfiles

public void delete_boxfiles( string $dir, [ boolean $recurs, boolean $rmdir, boolean $rmtag, string $pattern ] )

  Mnemonic shorthand

Parameter
string $dir
directory where are the files to delete
boolean $recurs = >>false<<
if true, runs through directories recursively
boolean $rmdir = >>false<<
delete directories?
boolean $rmtag = >>false<<
tag files for deletion?
string $pattern = >>".*"<<
name pattern of files to delete (english?!?)
Returns void

See Also delete_files()

delete_obsolete_news

public void delete_obsolete_news( integer $news_id )

  Delete outdated cache files for news $news_id

Parameter
integer $news_id
of the news
Returns void


Private Method Details

box_file_exists

private integer box_file_exists( string $file )

  Check whether file exists, with a lock mechanism to reduce SQL queries.

Parameter
string $file
of file to check
Returns integer

0 if file doesn't exist, 1 otherwise.


check_html

private void check_html( string $name )

  Return contents of HTML file if it exists
Calls include or readfile to pass the content to the browser, then exit.
Returns void if file exists.

Parameter
string $name
name of the file
Returns void


html_file_exists

private integer html_file_exists( string $file )

  Check whether file exists, with a lock mechanism to reduce SQL queries

Parameter
string $file
Returns integer

0 if does not exist, 1 if it does.


tag_delete_files

private void tag_delete_files( string $dir, boolean $location, boolean $recurs, string $pattern, string $dirpattern )

  Tag files for deletion

Parameter
string $dir
directory where are the files to delete
boolean $location
if true, $dir is subdir of htmldir, else of cachedir
boolean $recurs
if true, runs through directories recursively
string $pattern
name pattern of files to delete (english?!?)
string $dirpattern
name pattern of dirss to delete
Returns void


tag_file

private void tag_file( string $file, [ boolean $force ] )

  Creates a tag file

Parameter
string $file
filename
boolean $force = >>false<<
making if true.
Returns void


Private Field Details

$state

private boolean $state

>><<

State used in write_html()
0: HTML page is written to file
1: outdated, because some boxes were not up-to-date
2: a .del file has been found


$lock_delay

private integer $lock_delay

>><<

When an HTML file is locked up, wait x seconds
for the new version being regenerated


$mark_outdated

private boolean $mark_outdated

>><<

Is set to Config::mark_outdated


$topdir

private unknown $topdir

>><<

Is set to Config::topdir


$cachedir

private unknown $cachedir

>><<

Is set to Config::cachedir


$htmldir

private unknown $htmldir

>><<

Is set to Config::htmldir


$db

private object Db $db

>><<

Db abstraction layer


$session

private object Session $session

>><<

Session instance


$utils

private object Utils $utils

>><<

Utils instance



Packageindex Classtrees Modulegroups Elementlist Report XML Files
PHPDoc 1.0beta