Created
December 1, 2012 08:14
-
-
Save paperen/4181071 to your computer and use it in GitHub Desktop.
Querycache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* 作為查詢緩存记录器 | |
* @author paperen | |
*/ | |
class Querycache | |
{ | |
private $_cache; | |
/** | |
* 根据索引获取缓存数据 | |
* @param string $hash 索引 | |
* @return mixed | |
*/ | |
public function get( $hash ) { | |
return isset( $this->_cache[$hash] ) ? $this->_cache[$hash] : NULL; | |
} | |
/** | |
* 保存缓存 | |
* @param string $hash 索引 | |
* @param mixed $data 数据 | |
*/ | |
public function save( $hash, $data ) { | |
$this->_cache[$hash] = $data; | |
} | |
} | |
// end of Querycache |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment