批量取数据并(全量/增量)缓存结果(不是结果集)的抽象方法

/*
    * @param $id_list id列表
    * @param $mc_prefix mc前缀
    * @param $extra_param 其它参数
    * @param $callback
    * @return array()
    * @desc 根据id_list批量获取数据并缓存的抽象方法
     */
    public function getList($id_list, $mc_prefix, $extra_params, $callback) {
        $cache_id_list = array();
        foreach($id_list as $_id) {
            $cache_id_list[$_id] = $mc_prefix . $_id;
        }
        $mc = Yaf_Registry::get('cache');
        $ret = array();
        if (!$_SERVER['mc_disable'] && (false !== ($ret_mc=$mc->get($cache_id_list)))) {
            $not_hit = array();
            foreach($cache_id_list as $_id => $_cache_id) {
                if (isset($ret_mc[$_cache_id]) && $ret_mc[$_cache_id]) {
                    $ret[$_id] = $ret_mc[$_cache_id];
                } else {
                    $not_hit[] = $_id;
                }
            }

            if ($not_hit) {
                $not_mc_ret = call_user_func_array($callback, array('id_list' => $not_hit) + $extra_params);
                $ret += $not_mc_ret;
            }
        } else {
            $not_mc_ret = call_user_func_array($callback, array('id_list' => $id_list) + $extra_params);
            $ret = $not_mc_ret;
        }
        if ($not_mc_ret) {
            foreach($not_mc_ret as $_id => $_data) {
                if ($_data) {
                    $cache_id = $mc_prefix . $_id;
                    $mc->set($cache_id, $_data, 86400);
                }
            }
        }

        $return = array();
        foreach($id_list as $_id) {
            if (isset($ret[$_id])) {
                $return[$_id] = $ret[$_id];
            }
        }
        return $return;
    }