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

Class: Cache_Container_dbx

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

Class Overview

Cache_Container
   |
   --Cache_Container_dbx

ext/dbx Cache Container.


Author(s):

Version:

  • $Id: dbx.php,v 1.4 2003/01/04 11:54:46 mj 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.4 2003/01/04 11:54:46 mj Exp $


[ Top ]


Class Variables

$cache_table =  ''

[line 63]

Name of the DB table to store caching data

Type:   mixed


[ Top ]

$db =  ''

[line 86]

DB database to use

Type:   string


[ Top ]

$db =

[line 107]

DBx handle object
  • Var: handle

Type:   object DBx


[ Top ]

$host =  ''

[line 79]

DB host to use

Type:   string


[ Top ]

$module =  ''

[line 72]

DBx module to use

at the moment only mysql or odbc


Type:   string


[ Top ]

$password =  ''

[line 100]

DB password to use

Type:   string


[ Top ]

$persistent =  true

[line 115]

Establish a persistent connection?

Type:   boolean


[ Top ]

$username =  ''

[line 93]

DB username to use

Type:   string


[ Top ]



Method Detail

Cache_Container_dbx (Constructor)   [line 118]

Cache_Container_dbx Cache_Container_dbx( $options)


Parameters:

   $options   — 

[ Top ]

fetch   [line 139]

void fetch( $id, $group)


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

Parameters:

   $id   — 
   $group   — 

[ Top ]

flush   [line 216]

void flush( [ $group = ''])


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

Parameters:

   $group   — 

[ Top ]

garbageCollection   [line 255]

void garbageCollection( $maxlifetime)


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

Parameters:

   $maxlifetime   — 

[ Top ]

idExists   [line 232]

void idExists( $id, $group)


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

Parameters:

   $id   — 
   $group   — 

[ Top ]

remove   [line 200]

void remove( $id, $group)


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

Parameters:

   $id   — 
   $group   — 

[ Top ]

save   [line 180]

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 10:14:23 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.