ob_implicit_flush example

            return call_user_func_array($callback$parameters);
        }

        $id = $this->_makeId($callback$parameters);
        if ( ($rs = $this->load($id)) && isset($rs[0]$rs[1])) {
            // A cache is available             $output = $rs[0];
            $return = $rs[1];
        } else {
            // A cache is not available (or not valid for this frontend)             ob_start();
            ob_implicit_flush(false);
            $return = call_user_func_array($callback$parameters);
            $output = ob_get_clean();
            $data = array($output$return);
            $this->save($data$id$tags$specificLifetime$priority);
        }

        echo $output;
        return $return;
    }

    /** * ZF-9970 * * @deprecated */
/** * Start the cache * * @param string $id Cache id * @return mixed True if the cache is hit (false else) with $echoData=true (default) ; string else (datas) */
    public function start($id, array $tags$extension = null)
    {
        $this->_tags = $tags;
        $this->_extension = $extension;
        ob_start(array($this, '_flush'));
        ob_implicit_flush(false);
        $this->_idStack[] = $id;
        return false;
    }

    /** * callback for output buffering * (shouldn't really be called manually) * * @param string $data Buffered output * @return string Data to send to browser */
    

            if ($this->_specificOptions['debug_header']) {
                echo 'DEBUG HEADER : This is a cached page !';
            }
            echo $data;
            if ($doNotDie) {
                return true;
            }
            die();
        }
        ob_start(array($this, '_flush'));
        ob_implicit_flush(false);
        return false;
    }

    /** * Cancel the current caching process */
    public function cancel()
    {
        $this->_cancel = true;
    }

    

        $data = $this->load($id$doNotTestCacheValidity);
        if ($data !== false) {
            if ( $echoData ) {
                echo($data);
                return true;
            } else {
                return $data;
            }
        }
        ob_start();
        ob_implicit_flush(false);
        $this->_idStack[] = $id;
        return false;
    }

    /** * Stop the cache * * @param array $tags Tags array * @param int $specificLifetime If != false, set a specific lifetime for this cache record (null => infinite lifetime) * @param string $forcedDatas If not null, force written datas with this * @param boolean $echoData If set to true, datas are sent to the browser * @param int $priority integer between 0 (very low priority) and 10 (maximum priority) used by some particular backends * @return void */
            return call_user_func_array($callback$parameters);
        }

        $id = $this->_makeId($name$parameters);
        if ( ($rs = $this->load($id)) && isset($rs[0]$rs[1]) ) {
            // A cache is available             $output = $rs[0];
            $return = $rs[1];
        } else {
            // A cache is not available (or not valid for this frontend)             ob_start();
            ob_implicit_flush(false);

            try {
                $return = call_user_func_array($callback$parameters);
                $output = ob_get_clean();
                $data = array($output$return);
                $this->save($data$id$this->_tags, $this->_specificLifetime, $this->_priority);
            } catch (Exception $e) {
                ob_end_clean();
                throw $e;
            }
        }

        

    public function start(string $name)
    {
        if (\in_array($name$this->openSlots)) {
            throw new \InvalidArgumentException(sprintf('A slot named "%s" is already started.', $name));
        }

        $this->openSlots[] = $name;
        $this->slots[$name] = '';

        ob_start();
        ob_implicit_flush(0);
    }

    /** * Stops a slot. * * @return void * * @throws \LogicException if no slot has been started */
    public function stop()
    {
        
Home | Imprint | This part of the site doesn't use cookies.