[ Index ]
 

Code source de PHP PEAR 1.4.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/Cache/Container/ -> mdb.php (sommaire)

(pas de description)

Poids: 381 lignes (14 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 2 fichiers
 Cache/Container.php
 MDB.php

Définit 1 class

Cache_Container_mdb:: (7 méthodes):
  Cache_Container_mdb()
  fetch()
  save()
  remove()
  flush()
  idExists()
  garbageCollection()


Classe: Cache_Container_mdb  - X-Ref

PEAR/MDB Cache Container.

NB: The field 'changed' has no meaning for the Cache itself. It's just there
because it's a good idea to have an automatically updated timestamp
field for debugging in all of your tables.

A XML MDB-compliant schema example for the table needed is provided.
Look at the file "mdb_cache_schema.xml" for that.

------------------------------------------
A basic usage example:
------------------------------------------

$dbinfo = array(
'database'    => 'dbname',
'phptype'     => 'mysql',
'username'    => 'root',
'password'    => '',
'cache_table' => 'cache'
);


$cache = new Cache('mdb', $dbinfo);
$id = $cache->generateID('testentry');

if ($data = $cache->get($id)) {
echo 'Cache hit.<br />Data: '.$data;

} else {
$data = 'data of any kind';
$cache->save($id, $data);
echo 'Cache miss.<br />';
}

------------------------------------------

Cache_Container_mdb($options)   X-Ref
Constructor

param: mixed Array with connection info or dsn string

fetch($id, $group)   X-Ref
Fetch in the db the data that matches input parameters

param: string  dataset ID
param: string  cache group
return: mixed   dataset value or NULL/Cache_Error on failure

save($id, $data, $expires, $group, $userdata)   X-Ref
Stores a dataset in the database

If dataset_ID already exists, overwrite it with new data,
else insert data in a new record.

param: string  dataset ID
param: mixed   data to be cached
param: integer expiration time
param: string  cache group
param: string  userdata

remove($id, $group)   X-Ref
Removes a dataset from the database

param: string  dataset ID
param: string  cache group

flush($group = '')   X-Ref
Remove all cached data for a certain group, or empty
the cache table if no group is specified.

param: string  cache group

idExists($id, $group)   X-Ref
Check if a dataset ID/group exists.

param: string  dataset ID
param: string  cache group
return: boolean

garbageCollection($maxlifetime)   X-Ref
Garbage collector.

param: int maxlifetime



Généré le : Sun Feb 25 14:08:00 2007 par Balluche grâce à PHPXref 0.7