Skip to content

Instantly share code, notes, and snippets.

@paperen
Created December 1, 2012 08:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paperen/4181071 to your computer and use it in GitHub Desktop.
Save paperen/4181071 to your computer and use it in GitHub Desktop.
Querycache
<?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