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

Class: Cache_Container_dbx

Source Location: /Cache-1.5.5/Container/dbx.php

Class Overview

Cache_Container
   |
   --Cache_Container_dbx

ext/dbx Cache Container.


Author(s):

Version:

  • $Id: dbx.php,v 1.6 2004/12/15 09:09:29 dufuz Exp $

Variables

Methods


Inherited Variables

Inherited Methods

Class: Cache_Container

Cache_Container::decode()
Decodes the data from the storage container.
Cache_Container::encode()
Encodes the data for the storage container.
Cache_Container::fetch()
Fetches a dataset from the storage medium.
Cache_Container::flush()
Flushes the cache - removes all caches datasets from the cache.
Cache_Container::flushPreload()
Flushes the internal preload buffer.
Cache_Container::garbageCollection()
Starts the garbage collection.
Cache_Container::getExpiresAbsolute()
Translates human readable/relative times in unixtime
Cache_Container::getUserdata()
Returns the userdata field of a cached data set.
Cache_Container::idExists()
Checks if a dataset exists.
Cache_Container::isCached()
Checks if a dataset is cached.
Cache_Container::isExpired()
Checks if a dataset is expired.
Cache_Container::load()
Loads a dataset from the cache.
Cache_Container::preload()
Does a speculative preload of a dataset
Cache_Container::remove()
Removes a dataset.
Cache_Container::save()
Stores a dataset.
Cache_Container::setOptions()
Imports the requested datafields as object variables if allowed

Class Details

[line 56]
ext/dbx Cache Container.

WARNING: Other systems might or might not support certain datatypes of the tables shown. As far as I know there's no large binary type in SQL-92 or SQL-99. Postgres seems to lack any BLOB or TEXT type, for MS-SQL you could use IMAGE, don't know about other databases. Please add sugestions for other databases to the inline docs.

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.

For _MySQL_ you need this DB table:

CREATE TABLE cache ( id CHAR(32) NOT null DEFAULT '', cachegroup VARCHAR(127) NOT null DEFAULT '', cachedata BLOB NOT null DEFAULT '', userdata VARCHAR(255) NOT null DEFAULT '', expires INT(9) NOT null DEFAULT 0,

changed TIMESTAMP(14) NOT null,

INDEX (expires), PRIMARY KEY (id, cachegroup) )

  • Author: Christian Stocker <chregu@phant.ch>
  • Version: $Id: dbx.php,v 1.6 2004/12/15 09:09:29 dufuz Exp $


[ Top ]


Class Variables

$cache_table =  ''

[line 64]

Name of the DB table to store caching data

Type:   mixed


[ Top ]

$db =  ''

[line 87]

DB database to use

Type:   string


[ Top ]

$db =

[line 108]

DBx handle object
  • Var: handle

Type:   object DBx


[ Top ]

$host =  ''

[line 80]

DB host to use

Type:   string


[ Top ]

$module =  ''

[line 73]

DBx module to use

at the moment only mysql or odbc


Type:   string


[ Top ]

$password =  ''

[line 101]

DB password to use

Type:   string


[ Top ]

$persistent =  true

[line 116]

Establish a persistent connection?

Type:   boolean


[ Top ]

$username =  ''

[line 94]

DB username to use

Type:   string


[ Top ]



Method Detail

Cache_Container_dbx (Constructor)   [line 119]

Cache_Container_dbx Cache_Container_dbx( $options)


Parameters:

   $options   — 

[ Top ]

fetch   [line 140]

void fetch( $id, $group)


Overrides Cache_Container::fetch() (Fetches a dataset from the storage medium.)

Parameters:

   $id   — 
   $group   — 

[ Top ]

flush   [line 218]

void flush( [ $group = ''])


Overrides Cache_Container::flush() (Flushes the cache - removes all caches datasets from the cache.)

Parameters:

   $group   — 

[ Top ]

garbageCollection   [line 257]

void garbageCollection( $maxlifetime)


Overrides Cache_Container::garbageCollection() (Starts the garbage collection.)

Parameters:

   $maxlifetime   — 

[ Top ]

idExists   [line 235]

void idExists( $id, $group)


Overrides Cache_Container::idExists() (Checks if a dataset exists.)

Parameters:

   $id   — 
   $group   — 

[ Top ]

remove   [line 201]

void remove( $id, $group)


Overrides Cache_Container::remove() (Removes a dataset.)

Parameters:

   $id   — 
   $group   — 

[ Top ]

save   [line 181]

void save( $id, $data, $expires, $group, $userdata)

Stores a dataset.

WARNING: we use the SQL command REPLACE INTO this might be MySQL specific. As MySQL is very popular the method should work fine for 95% of you.


Overrides Cache_Container::save() (Stores a dataset.)

Parameters:

   $id   — 
   $data   — 
   $expires   — 
   $group   — 
   $userdata   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:25:49 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.