Class: Doctrine_Cache

Source Location: /Doctrine/Cache.php

Class Doctrine_Cache

Class Overview

Implements interfaces:

  • Countable (internal interface)
  • IteratorAggregate (internal interface)

Doctrine_Cache

Located in /Doctrine/Cache.php [line 34]

Doctrine_EventListener
   |
   --Doctrine_Cache
Author(s): Information Tags:
Version:  $Revision: 1857 $
Link:  www.phpdoctrine.com
Since:  1.0
License:  LGPL

Properties

Methods

[ Top ]
Inherited Properties, Constants, and Methods
Property Summary
array   $_data  
Doctrine_Cache_Interface   $_driver  
array   $_options  
array   $_queries  
boolean   $_success  

[ Top ]
Method Summary
Doctrine_Cache   __construct()   constructor
void   add()   add adds a query to internal query stack
void   appendStats()   appendStats
boolean   clean()   save
integer   count()   count
array   getAll()   getQueries
Doctrine_Cache_Driver   getDriver()   getDriver returns the current cache driver
ArrayIterator   getIterator()   getIterator
mixed   getOption()   getOption
boolean   isSuccessful()  
string   pop()   pop
boolean   preExecute()   preExecute listens the preExecute event of Doctrine_Connection_Statement
array   preFetch()   preFetch listens the preFetch event of Doctrine_Connection_Statement
array   preFetchAll()   preFetch listens the preFetchAll event of Doctrine_Connection_Statement
boolean   preQuery()   preQuery listens on the Doctrine_Event preQuery event
array   readStats()   readStats
void   reset()   reset
boolean   setOption()   setOption

[ Top ]
Properties
array   $_data = array() [line 57]
API Tags:
Access:  protected


[ Top ]
Doctrine_Cache_Interface   $_driver [line 53]
API Tags:
Access:  protected


[ Top ]
array   $_options = array('size' => 1000,
'lifeTime' => 3600,
'addStatsPropability' => 0.25,
'savePropability' => 0.10,
'cleanPropability' => 0.01,
'statsFile' => '../data/stats.cache',
)
[line 39]
API Tags:
Access:  protected


[ Top ]
array   $_queries = array() [line 49]
API Tags:
Access:  protected


[ Top ]
boolean   $_success = false [line 61]
API Tags:
Access:  protected


[ Top ]
Methods
Constructor __construct  [line 68]

  Doctrine_Cache __construct( Doctrine_Cache_Interface|string $driver, [array $options = array()]  )

constructor

Parameters:
Doctrine_Cache_Interface|string   $driver:  cache driver name or a driver object
array   $options:  cache driver options

API Tags:
Access:  public


[ Top ]
add  [line 139]

  void add( string|array $query, [string $namespace = null]  )

add adds a query to internal query stack

Parameters:
string|array   $query:  sql query string
string   $namespace:  connection namespace

API Tags:
Access:  public


[ Top ]
appendStats  [line 267]

  void appendStats( )

appendStats

adds all queries to stats file


API Tags:
Access:  public


[ Top ]
clean  [line 215]

  boolean clean( )

save


API Tags:
Access:  public


[ Top ]
count  [line 190]

  integer count( )

count


API Tags:
Return:  the number of queries in the stack
Access:  public


Implementation of:
Countable::count

[ Top ]
getAll  [line 153]

  array getAll( [string $namespace = null]  )

getQueries

Parameters:
string   $namespace:  optional query namespace

API Tags:
Return:  an array of sql query strings
Access:  public


[ Top ]
getDriver  [line 93]

  Doctrine_Cache_Driver getDriver( )

getDriver returns the current cache driver


API Tags:
Access:  public


[ Top ]
getIterator  [line 199]

  ArrayIterator getIterator( )

getIterator


API Tags:
Return:  an iterator that iterates through the query stack
Access:  public


Implementation of:
IteratorAggregate::getIterator

[ Top ]
getOption  [line 123]

  mixed getOption( mixed $option  )

getOption

Parameters:
mixed   $option:  the option name

API Tags:
Return:  option value
Access:  public


[ Top ]
isSuccessful  [line 206]

  boolean isSuccessful( )


API Tags:
Return:  whether or not the last cache operation was successful
Access:  public


[ Top ]
pop  [line 171]

  string pop( )

pop

pops a query from the stack


API Tags:
Access:  public


[ Top ]
preExecute  [line 362]

  boolean preExecute( Doctrine_Event $event  )

preExecute listens the preExecute event of Doctrine_Connection_Statement

adds the issued query to internal query stack and checks if cached element exists

Parameters:
Doctrine_Event   $event: 

API Tags:
Access:  public


[ Top ]
preFetch  [line 335]

  array preFetch( Doctrine_Event $event  )

preFetch listens the preFetch event of Doctrine_Connection_Statement

advances the internal pointer of cached data and returns the current element

Parameters:
Doctrine_Event   $event: 

API Tags:
Access:  public


Redefinition of:
Doctrine_EventListener::preFetch()

[ Top ]
preFetchAll  [line 349]

  array preFetchAll( Doctrine_Event $event  )

preFetch listens the preFetchAll event of Doctrine_Connection_Statement

returns the current cache data array

Parameters:
Doctrine_Event   $event: 

API Tags:
Access:  public


Redefinition of:
Doctrine_EventListener::preFetchAll()

[ Top ]
preQuery  [line 291]

  boolean preQuery( Doctrine_Event $event  )

preQuery listens on the Doctrine_Event preQuery event

adds the issued query to internal query stack and checks if cached element exists

Parameters:
Doctrine_Event   $event: 

API Tags:
Access:  public


Redefinition of:
Doctrine_EventListener::preQuery()

[ Top ]
readStats  [line 250]

  array readStats( )

readStats


API Tags:
Access:  public


[ Top ]
reset  [line 181]

  void reset( )

reset

removes all queries from the query stack


API Tags:
Access:  public


[ Top ]
setOption  [line 104]

  boolean setOption( mixed $option, mixed $value  )

setOption

Parameters:
mixed   $option:  the option name
mixed   $value:  option value

API Tags:
Return:  TRUE on success, FALSE on failure
Access:  public


[ Top ]