All pastes #966690 Raw Edit

Anonymous

public php v1 · immutable
·published 2008-04-01 22:21 UTC
rendered paste body
		/**		* @return mixed array		* @param file $file		* @param int $expire		* @param string $sql		* @param mixed $args		*/		function CQuery($file, $expire, $sql, $args='')		{				if(file_exists($file))			{				if(filemtime($file) > (time() - $expire))				{					$records = unserialize(implode('', file($file)));				} else {					if($args)					{						if(!is_array($args))						{							$args = array($args);						}												$records = $this->Query($sql, $args);					} else {						$records = $this->Query($sql);					}					$data = serialize($records);					$fp = fopen($file, "w");					fputs($fp, $data);					fclose($fp);				}			} else {				trigger_error("No cache file specified");			}						return $records;		}