DbcacheTiered

Filepath: phork/php/cache/dbcache/DbcacheTiered.class.php and phork/php/cache/dbcache/CacheModel.class.php

The DbcacheTiered class is a caching adaptor that uses the database system to cache the data in the database. It also adds the ability to cache data in namespaces. This allows you to easily flush a single namespace without having to flush the entire cache.

The cache configuration file defines the read and write databases.


Configuration Example

//the cache type must have a corresponding class
$arrConfig['Type'] = 'Dbcache';

//the database configuration for the base tier
$arrConfig['Tiers']['Base']['TierKey'] = 'base';
$arrConfig['Tiers']['Base']['Database'] = array(
    'Type'        => 'MySql',
    'Connections'     => array(
        'Read'            => array(
            'User'            => 'your_username',
            'Password'        => 'your_password',
            'Host'            => 'localhost',
            'Port'            => 3306,
            'Database'        => 'phork',
            'Persistent'      => false
        ),
        'Write'           => array(
            'User'            => 'your_username',
            'Password'        => 'your_password',
            'Host'            => 'localhost',
            'Port'            => 3306,
            'Database'        => 'phork',
            'Persistent'      => false
        )
    )
);

//the database configuration for the presentation tier
$arrConfig['Tiers']['Presentation']['TierKey'] = 'pres';
$arrConfig['Tiers']['Presentation']['Database'] =& $arrConfig['Tiers']['Base']['Database'];