Overview   Package   Tree   Index 
Tv2 documentation
PREV  NEXT FRAMES  NO FRAME 
SUMMARY:  FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

tv2-engine
Class ctlRtVarCache


class ctlRtVarCache

General purpose runtime cache for variables and objects

Authors:
Emilis Dambauskas (emilis@gildija.lt)
Version:
$Id: ctlRtVarCache.class.php,v 1.2 2003/07/09 05:36:03 lunaticlt Exp $
Copyright:
2002–2003 Emilis Dambauskas under Artistic license

Field Summary
private integer$counter
Counter.
private array$data
Stored data array
private array$keys
Key array
private integer$size
Cache size
private array$types
Array containing types of vars/objects stored in cache

Constructor Summary
void ctlRtVarCache([integer $limit])
Constructor.

Method Summary
boolean add(string $type, mixed $keys, [string $ObjectMethod], [array $ObjectMethodParams])
Adds var to cache
boolean addKey(string $type, array $keys)
Adds another key alias for a var
private mixed callObjectMethod(mixed $id, string $ObjectMethod, [array $ObjectMethodParams])
This method calls a method on object in cache with given $id.
void debugOut()
This function prints info about cache contents grouped by types.
boolean delete(string $type, mixed $keys, [string $ObjectMethod], [array $ObjectMethodParams])
Deletes entity from cache.
boolean deleteKeys(string $type, mixed $keys, [boolean $many], [string $ObjectMethod], [array $ObjectMethodParams])
Removes keys that correspond to the var.
private boolean error(string $msg)
Sends an error to the errors object and returns FALSE
mixed exists(string $type, mixed $keys)
Checks if var exists in cache
mixed& find(string $type, mixed $keys)
Searches for var and returns a reference to it
private mixed findId(string $type, mixed $keys)
Returns internal variable id
private mixed findTypeId(string $type)
Returns internal type id


Field Detail

counter

private integer $counter

Counter. Needed for indexing vars


data

private array $data

Stored data array


keys

private array $keys

Key array


size

private integer $size

Cache size


types

private array $types

Array containing types of vars/objects stored in cache


Constructor Detail

ctlRtVarCache()

void ctlRtVarCache([integer $limit])

Constructor. Initializes attributes

Parameters:
limit - cache size (default 100)

Method Detail

add()

boolean add(string $type, mixed $keys, [string $ObjectMethod], [array $ObjectMethodParams])

Adds var to cache

Parameters:
type - type name
keys - key name, or key name array
ObjectMethod - method name to call on object
ObjectMethodParams - parameters for the method
Returns:
TRUE on success, FALSE on error

addKey()

boolean addKey(string $type, array $keys)

Adds another key alias for a var

Parameters:
type - type name
keys - array of keys (should contain at least one previously used key).
Returns:
TRUE on success, FALSE on failure

callObjectMethod()

private mixed callObjectMethod(mixed $id, string $ObjectMethod, [array $ObjectMethodParams])

This method calls a method on object in cache with given $id. Used in $this->delete() and $this->deleteKeys() methods.

Parameters:
id - id of object in cache
ObjectMethod - Object method name
ObjectMethodParams - Array of parameters to be passed to the method.
Returns:
whatever the object method returns or FALSE on failure

debugOut()

void debugOut()

This function prints info about cache contents grouped by types. Usefull for debugging purposes.


delete()

boolean delete(string $type, mixed $keys, [string $ObjectMethod], [array $ObjectMethodParams])

Deletes entity from cache. Can optionally call a method on objects.

Parameters:
type - type name
keys - key name or key name array
ObjectMethod - method name to call on object
ObjectMethodParams - parameters for the method
Returns:
TRUE on success, FALSE on failure

deleteKeys()

boolean deleteKeys(string $type, mixed $keys, [boolean $many], [string $ObjectMethod], [array $ObjectMethodParams])

Removes keys that correspond to the var.

Parameters:
type - type name
keys - key name or array of key names
many - If $many == TRUE it means that $keys may belong to different entities (makes operate slower). Default is FALSE.
ObjectMethod - method name to call on object
ObjectMethodParams - parameters for the method
Returns:
FALSE on failure

error()

private boolean error(string $msg)

Sends an error to the errors object and returns FALSE

Parameters:
msg - error message
Returns:
always FALSE
Uses the global variables:
errors

exists()

mixed exists(string $type, mixed $keys)

Checks if var exists in cache

Parameters:
type - type name
keys - key name or key name array
Returns:
internal id on success, FALSE on failure

find()

mixed& find(string $type, mixed $keys)

Searches for var and returns a reference to it

Parameters:
type - type name
keys - key name or array of key names
Returns:
mixed whatever the variable is

findId()

private mixed findId(string $type, mixed $keys)

Returns internal variable id

Parameters:
type - type name
keys - key name or key name array
Returns:
var id or FALSE on failure

findTypeId()

private mixed findTypeId(string $type)

Returns internal type id

Parameters:
type - type name
Returns:
type id or FALSE on failure

 Overview   Package   Tree   Index 
Tv2 documentation
PREV  NEXT FRAMES  NO FRAME 
SUMMARY:  FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Submit a bug

This document was generated by phpdocgen 0.17-rc3.
Copyright © 2002-03 Stéphane GALLAND (under the GNU General Public License)