public function buildCache($table = null, $key = null, $cache = null)
    {
        if ($this->sql &&
            ($table === null || $this->setTableName($table)) &&
            ($key === null || $this->setKeyName($key)) &&
            ($cache === null || $this->setCacheName($cache))) {
            if ($this->sql->query("
                CREATE TABLE IF NOT EXISTS `{$this->table}` (
                    `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
                    `{$this->key}` text NOT NULL,
                    `{$this->cache}` longtext NOT NULL,
                    `expire` timestamp NULL DEFAULT NULL,
                    `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
                    PRIMARY KEY (`id`)
                );
            ")) {
                $this->initialized = true;

                /* Upgrade older cache tables for longer cache data */
                $this->sql->query("
                    ALTER TABLE `{$this->table}` CHANGE `{$this->cache}` `{$this->cache}` longtext NOT NULL;
                ");

                /* Upgrade older cached tables to include an expire column for each row */
                $this->sql->query("
                    ALTER TABLE `{$this->table}` ADD `expire` timestamp NULL DEFAULT NULL AFTER `{$this->cache};
                ");
            }
        }
        return $this->initialized;
    }
public function buildCache($table = null, $key = null, $cache = null)
    {
        if ($this->sql &&
            ($table === null || $this->setTableName($table)) &&
            ($key === null || $this->setKeyName($key)) &&
            ($cache === null || $this->setCacheName($cache))) {
            if ($this->sql->query("
                CREATE TABLE IF NOT EXISTS `{$this->table}` (
                    `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
                    `{$this->key}` text NOT NULL,
                    `{$this->cache}` longtext NOT NULL,
                    `expire` timestamp NULL DEFAULT NULL,
                    `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
                    PRIMARY KEY (`id`)
                );
            ")) {
                $this->initialized = true;

                /* Upgrade older cache tables for longer cache data */
                $this->sql->query("
                    ALTER TABLE `{$this->table}` CHANGE `{$this->cache}` `{$this->cache}` longtext NOT NULL;
                ");

                /* Upgrade older cached tables to include an expire column for each row */
                $this->sql->query("
                    ALTER TABLE `{$this->table}` ADD `expire` timestamp NULL DEFAULT NULL AFTER `{$this->cache};
                ");
            }
        }
        return $this->initialized;
    }
public function buildCache ( $ table = null , $ key = null , $ cache = null ) { if ( $ this -> sql && ( $ table === null || $ this -> setTableName ( $ table ) ) && ( $ key === null || $ this -> setKeyName ( $ key ) ) && ( $ cache === null || $ this -> setCacheName ( $ cache ) ) ) { if ( $ this -> sql -> query ( "
                CREATE TABLE IF NOT EXISTS `{$this->table}` (
                    `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
                    `{$this->key}` text NOT NULL,
                    `{$this->cache}` longtext NOT NULL,
                    `expire` timestamp NULL DEFAULT NULL,
                    `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
                    PRIMARY KEY (`id`)
                );
            " ) ) { $ this -> initialized = true ; /* Upgrade older cache tables for longer cache data */ $ this -> sql -> query ( "
                    ALTER TABLE `{$this->table}` CHANGE `{$this->cache}` `{$this->cache}` longtext NOT NULL;
                " ) ; /* Upgrade older cached tables to include an expire column for each row */ $ this -> sql -> query ( "
                    ALTER TABLE `{$this->table}` ADD `expire` timestamp NULL DEFAULT NULL AFTER `{$this->cache};
                " ) ; } } return $ this -> initialized ; }
Create cache table in database

@param string $table (Optional) Cache table name
@param string $key (Optional) Cache key field name
@param string $cache (Optional) Cache storage field name

@return boolean Returns `TRUE` on success, `FALSE` on failure
Create cache table in database