[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
[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: 9bd8d89a17c380fbed098a4b79a9aa2a

query_cache.php - 关闭高亮
  1. <?php
  2. /**
  3.  * Temporary cache for sql
  4.  *
  5.  * @package classes
  6.  * @copyright Copyright 2003-2012 Zen Cart Development Team
  7.  * @copyright Created by Data-Diggers.com http://www.data-diggers.com/
  8.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  9.  * @version GIT: $Id: Author: Ian Wilson  Wed Jul 4 14:44:03 2012 +0100 New in v1.5.1 $
  10.  *  
  11.  */
  12. /**
  13.  * QueryCache
  14.  *
  15.  */
  16.  class QueryCache {
  17.  
  18.     function QueryCache() {
  19.         $this->queries = array();
  20.     }
  21.  
  22.     // cache queries if and only if query is 'SELECT' statement
  23.     // returns:
  24.     //  TRUE - if and only if query has been stored in cache
  25.     //  FALSE - otherwise
  26.     function cache($query, $result) {
  27.         if ($this->isSelectStatement($query) === TRUE) $this->queries[$query] = $result;
  28.         else return(FALSE);
  29.         return(TRUE);
  30.     }
  31.  
  32.     function getFromCache($query) {
  33.         $ret = $this->queries[$query];
  34.         mysql_data_seek($ret, 0);
  35.         return($ret);
  36.     }
  37.  
  38.     function inCache($query) {
  39.         return(isset($this->queries[$query]));
  40.     }
  41.  
  42.     function isSelectStatement($q) {
  43.         if(($q[0] == 's' || $q[0] == 'S')
  44.                 && ($q[1] == 'e' || $q[1] == 'E')
  45.                 && ($q[2] == 'l' || $q[2] == 'L'))
  46.             return(true);
  47.         return(false);
  48.     }
  49.  
  50. }
  51.  
  52. ?>


cron