_test example

/** * Test if a cache is available for the given id and (if yes) return it (false else) * * @param string $id cache id * @param bool $doNotTestCacheValidity if set to true, the cache validity won't be tested * * @return string|false cached datas */
    public function load($id$doNotTestCacheValidity = false)
    {
        if (!($this->_test($id$doNotTestCacheValidity))) {
            // The cache is not hit !             return false;
        }

        return $this->_load($id);
    }

    /** * Test if a cache is available or not (for the given id) * * @param string $id cache id * * @return mixed false (a cache is not available) or "last modified" timestamp (int) of the available cache record */


    /** * Test if a cache is available for the given id and (if yes) return it (false else) * * @param string $id cache id * @param boolean $doNotTestCacheValidity if set to true, the cache validity won't be tested * @return string|false cached datas */
    public function load($id$doNotTestCacheValidity = false)
    {
        if (!($this->_test($id$doNotTestCacheValidity))) {
            // The cache is not hit !             return false;
        }
        $metadatas = $this->_getMetadatas($id);
        $file = $this->_file($id);
        $data = $this->_fileGetContents($file);
        if ($this->_options['read_control']) {
            $hashData = $this->_hash($data$this->_options['read_control_type']);
            $hashControl = $metadatas['hash'];
            if ($hashData != $hashControl) {
                // Problem detected by the read control !
Home | Imprint | This part of the site doesn't use cookies.