[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
Zen Cart 源代码 query_cache.php

Zen Cart 源代码 query_cache.php




下载文件

文件名: query_cache.php
文件类型: PHP文件
文件大小: 1.26 KiB
MD5: 5e1a275913b69601b29d85431396df5a

query_cache.php - 打开高亮
<?php
/**
 * Temporary cache for sql
 * 
 * @package classes
 * @copyright Copyright 2003-2012 Zen Cart Development Team
 * @copyright Created by Data-Diggers.com http://www.data-diggers.com/
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version GIT: $Id: Author: Ian Wilson  Wed Jul 4 14:44:03 2012 +0100 New in v1.5.1 $
 *  
 */
/**
 * QueryCache
 *
 */
 class QueryCache {

    function QueryCache() {
        $this->queries = array();
    }

    // cache queries if and only if query is 'SELECT' statement
    // returns:
    //    TRUE - if and only if query has been stored in cache
    //    FALSE - otherwise
    function cache($query, $result) {
        if ($this->isSelectStatement($query) === TRUE) $this->queries[$query] = $result;
        else return(FALSE);
        return(TRUE);
    }

    function getFromCache($query) {
        $ret = $this->queries[$query];
        mysql_data_seek($ret, 0);
        return($ret);
    }

    function inCache($query) {
        return(isset($this->queries[$query]));
    }

    function isSelectStatement($q) {
        if(($q[0] == 's' || $q[0] == 'S')
                && ($q[1] == 'e' || $q[1] == 'E')
                && ($q[2] == 'l' || $q[2] == 'L'))
            return(true);
        return(false);
    }

}

?>


cron