选择语言 :

 Module_Cache::get

获取指定KEY的缓存数据

$cache->get('a');
$cache->get('a','b','c');
$cache->get(array('a','b','c'));
mixed Module_Cache::get( string $key )

参数列表

参数 类型 描述 默认值
$key string 指定key
返回值
  • mixed
  • false 返回失败
File: ./modules/cache/cache.class.php
public function get($key)
{
    static $is_no_cache = null;

    if (null===$is_no_cache)
    {
        $is_no_cache = true === Core::debug()->profiler('nocached')->is_open();
    }
    if ( $is_no_cache && !$this->session_mode )
    {
        return null;
    }

    $columns = func_get_args();
    if (count($columns) > 1)
    {
        $key = $columns;
    }

    if (null===$key)
    {
        return null;
    }

    try
    {
        $data = $this->driver->get($key);

        if (is_array($data))
        {
            foreach ($data as & $item)
            {
                if (is_string($item))
                {
                    $this->_get_adv_data($item);
                }
            }
        }
        elseif (is_string($data))
        {
            $this->_get_adv_data($data);
        }

        return $data;
    }
    catch (Exception $e)
    {
        $this->last_error_msg = $e->getMessage();
        $this->last_error_no  = $e->getCode();
        return false;
    }
}