rootpackage
[ class tree: rootpackage ] [ index: rootpackage ] [ all elements ]

Class: BlueBox_CacheControl

Source Location: /BlueBox_CacheControl.php

Class Overview


Created on 14 mar 07


Author(s):

Version:

  • 2.0

Variables

Methods



Class Details

[line 16]
Created on 14 mar 07

This class manages BlueBox Cache control objects.

Changes: 1.0 to 2.0: phpdoc compatible in the way to generate documentation




Tags:

author:  Pierre-Dominique Vienne <pvienne@me.com>
version:  2.0
license:  GNU Public License


[ Top ]


Class Variables

$cachefile_content =

[line 110]

Variable that contains cache file content



Tags:

access:  public

Type:   string


[ Top ]

$cacheID =

[line 34]

Variable that contains cache ID



Tags:

access:  public

Type:   int


[ Top ]

$database =  "bluebox"

[line 23]

Variable that contains database name



Tags:

access:  public

Type:   string


[ Top ]

$debug =  false

[line 127]

Variable that contains debug switch



Tags:

access:  public

Type:   bool


[ Top ]

$error =

[line 132]

Variable that contains returned errors array



Tags:

access:  public

Type:   array


[ Top ]

$filename =

[line 94]

Variable that contains filename of the cache



Tags:

access:  public

Type:   string


[ Top ]

$filetypeID =  0

[line 69]

Variable that contains file type ID



Tags:

access:  public

Type:   int


[ Top ]

$from_filesize =  0

[line 74]

Variable that contains from octal filesize



Tags:

access:  public

Type:   int


[ Top ]

$from_ts =  0

[line 59]

Variable that contains from timestamp date



Tags:

access:  public

Type:   int


[ Top ]

$query_ts =

[line 84]

Variable that contains query timestamp date



Tags:

access:  public

Type:   int


[ Top ]

$query_url =

[line 89]

Variable that contains query url



Tags:

access:  public

Type:   string


[ Top ]

$request_result =

[line 100]

Variable that contains query result on search in DB



Tags:

access:  public

Type:   array


[ Top ]

$result =

[line 121]

Variable that contains result of query



Tags:

access:  public

Type:   array


[ Top ]

$search_method =

[line 44]

Variable that contains search method (OR, AND)



Tags:

access:  public

Type:   string


[ Top ]

$search_str =

[line 39]

Variable that contains search string



Tags:

access:  public

Type:   string


[ Top ]

$siteID =  0

[line 54]

Variable that contains site ID



Tags:

access:  public

Type:   int


[ Top ]

$stockage_method =  "XML"

[line 105]

Variable that contains method to be used to stock cache



Tags:

access:  public

Type:   string


[ Top ]

$strict =  false

[line 49]

Variable that contains switch defining if search must be strict or not



Tags:

access:  public

Type:   bool


[ Top ]

$table =  "cache_control"

[line 28]

Variable that contains table name



Tags:

access:  public

Type:   string


[ Top ]

$to_filesize =  0

[line 79]

Variable that contains to octal filesize



Tags:

access:  public

Type:   int


[ Top ]

$to_ts =  0

[line 64]

Variable that contains to timestamp date



Tags:

access:  public

Type:   int


[ Top ]



Class Methods


constructor __construct [line 149]

BlueBox_CacheControl __construct( )

Construction function

This function is used when object is generated. It places the right values from DB in each variables.

  1.  <?php
  2.  $oBB_CacheControl    new BlueBox_CacheControl();
  3.  ?>




Tags:

since:  Version 1.0
uses:  BlueBox_Config::ValueByName()


[ Top ]

method CacheFile_Creation [line 348]

bool CacheFile_Creation( string $this->search_str, string $this->search_method, int $this->siteID, string $this->cachefiles_directory)

Cache file creation function

This function is used to generates cache file content Result is returned

  1.  <?php
  2.  $oBB_CC                    new BlueBox_CacheControl();
  3.  $oBB_CC->search_str        $searchstr;
  4.  $oBB_CC->search_method    "AND";
  5.  $oBB_CC->siteID            1;
  6.  echo $oBB_CC->CacheFile_Creation();
  7.  // 1
  8.  ?>




Tags:

return:  true when function has encountered success
since:  Version 1.0
usedby:  BlueBox_CacheControl::InsertQuery()
uses:  BlueBox_CacheControl::MD5_Creation()
uses:  BlueBox_CacheControl::InsertQuery()
uses:  BlueBox_CacheControl::CacheFile_Generation()


Parameters:

string   $this->search_str   search string (required)
string   $this->search_method   search method (required)
int   $this->siteID   ID of the site (required)
string   $this->cachefiles_directory   directory where to put the cache files (required)

[ Top ]

method CacheFile_Generation [line 268]

void CacheFile_Generation( array $this->request_result, string $this->stockage_method)

Database searching function

This function is used to generates cache file content Result is stored in $this->cachefile_content

  1.  <?php
  2.  $oBB_CC                    new BlueBox_CacheControl();
  3.  $oBB_CC->request_result    $aResults;
  4.  $oBB_CC->CacheFile_Generation();
  5.  echo $oBB_CC->cachefile_content;
  6.  // cachefilecontent
  7.  ?>




Tags:

since:  Version 1.0
usedby:  BlueBox_CacheControl::CacheFile_Creation()


Parameters:

array   $this->request_result   array containing cache content (required)
string   $this->stockage_method   way to store the data

[ Top ]

method CheckFile [line 554]

int CheckFile( string $this->filename, string $this->cachefiles_directory)

File check function

This function is used to check if cache file exists and suppresses DB entry if cache file is not present Result is returned

  1.  <?php
  2.  $oBB_CC                    new BlueBox_CacheControl();
  3.  $oBB_CC->filename        $filename;
  4.  echo $oBB_CC->CheckFile();
  5.  // 1
  6.  ?>




Tags:

return:  ID of the deleted row
since:  Version 1.0
uses:  BlueBox_CacheControl::InDB()


Parameters:

string   $this->filename   filename
string   $this->cachefiles_directory   directory that contains cachefiles

[ Top ]

method InDB [line 186]

bool InDB( string $this->search_str, string $this->search_method, int $this->siteID)

Database searching function

This function is used to search in database if query exists Result is returned

  1.  <?php
  2.  $oBB_CC                    new BlueBox_CacheControl();
  3.  $oBB_CC->search_str        $searchstr;
  4.  $oBB_CC->search_method    "AND";
  5.  $oBB_CC->siteID            1;
  6.  echo $oBB_CC->InBB();
  7.  // 1
  8.  ?>




Tags:

return:  True if is in database
since:  Version 1.0
usedby:  BlueBox_CacheControl::CheckFile()
usedby:  BlueBox_CacheControl::InsertQuery()
uses:  BlueBox_CacheControl::SortSearch_str()
uses:  BlueBox_CacheControl::MD5_Creation()
uses:  MySQL::SelectRow()


Parameters:

string   $this->search_str   text corresponding to text entered (required)
string   $this->search_method   used searched method (required)
int   $this->siteID   ID of the site to be searched in (required)

[ Top ]

method InsertQuery [line 494]

int InsertQuery( string $this->search_str, string $this->search_method, int $this->siteID)

Query insertion function

This function is used to create an entry in table to identify that query has been executed Result is returned

  1.  <?php
  2.  $oBB_CC                    new BlueBox_CacheControl();
  3.  $oBB_CC->search_str        $searchstr;
  4.  $oBB_CC->search_method    "AND";
  5.  $oBB_CC->siteID            1;
  6.  echo $oBB_CC->InsertQuery();
  7.  // 12
  8.  ?>




Tags:

return:  ID of the inserted row
since:  Version 1.0
usedby:  BlueBox_CacheControl::CacheFile_Creation()
uses:  MySQL::InsertDatas()
uses:  BlueBox_CacheControl::InDB()
uses:  BlueBox_CacheControl::CacheFile_Creation()


Parameters:

string   $this->search_str   search string (required)
string   $this->search_method   search method (required)
int   $this->siteID   ID of the site (required)

[ Top ]

method MD5_Creation [line 424]

string MD5_Creation( string $this->search_str, string $this->search_method, int $this->siteID)

MD5 generation function

This function is used to generates a md5 string for query Result is returned

  1.  <?php
  2.  $oBB_CC                    new BlueBox_CacheControl();
  3.  $oBB_CC->search_str        $searchstr;
  4.  $oBB_CC->search_method    "AND";
  5.  $oBB_CC->siteID            1;
  6.  echo $oBB_CC->MD5_Creation();
  7.  // generatedmd5
  8.  ?>




Tags:

return:  md5 string
since:  Version 1.0
usedby:  BlueBox_CacheControl::CacheFile_Creation()
usedby:  BlueBox_CacheControl::InDB()


Parameters:

string   $this->search_str   search string (required)
string   $this->search_method   search method (required)
int   $this->siteID   ID of the site (required)

[ Top ]

method ParseCache [line 602]

array ParseCache( string $this->filename, string $this->cachefiles_directory, string $this->stockage_method)

File check function

This function is used to open and parse the cache file Result is returned

  1.  <?php
  2.  $oBB_CC                    new BlueBox_CacheControl();
  3.  $oBB_CC->filename        $filename;
  4.  print_r($oBB_CC->ParseCache());
  5.  // cachecontent
  6.  ?>




Tags:

return:  array containing results
since:  Version 1.0
uses:  Files::GetExtensionByFilename()


Parameters:

string   $this->filename   filename (required)
string   $this->cachefiles_directory   directory that contains cachefiles
string   $this->stockage_method   stockage method

[ Top ]

method SortSearch_str [line 235]

void SortSearch_str( string $this->search_str)

Database searching function

This function is used to sort search string in manner to have "Blue Box" reacting exactly like "Box Blue" Result is stored in $this->search_str

  1.  <?php
  2.  $oBB_CC                    new BlueBox_CacheControl();
  3.  $oBB_CC->search_str        $searchstr;
  4.  echo $oBB_CC->SortSearch_str();
  5.  // $sortedsearchstr
  6.  ?>




Tags:

since:  Version 1.0
usedby:  BlueBox_CacheControl::InDB()


Parameters:

string   $this->search_str   text corresponding to text entered (required)

[ Top ]


Documentation generated on Wed, 26 Aug 2009 12:29:58 +0200 by phpDocumentor 1.4.1