cache::clear PHP Method

clear() public method

public clear ( $key )
    function clear($key)
    {
        $cache_path = self::name($key);
        if (file_exists($cache_path)) {
            return unlink($cache_path);
        }
        return false;
    }

Usage Example

 /**
  * @author Mauricio Giraldo
  * @desc Executes a query stores in $sql variable
  * @version 1.0 03/05/2010
  * @param None
  * @return Boolean
  */
 public function query($sql = "")
 {
     if (!$sql) {
         $sql = $this->sql;
     }
     // Validate malicious code is not present:
     //if (!strpos(strtolower($sql), "alter") && !strpos(strtolower($sql), "drop") && !strpos(strtolower($sql), "create")) {
     logFactory::log($this, $sql);
     $this->RES = mysql_query($sql) or logFactory::error($this, mysql_error());
     //$this->RES = mysql_query($sql) or print(mysql_error().":".$sql);
     $cache = new cache();
     if (${$_POST}["do"] == "insert_exec" && $_POST["do"] != "insert_exec" && $_POST["do"] != "edit_exec") {
         $cache->clear();
     }
     return true;
     //}
     //else
     //return false;
 }
All Usage Examples Of cache::clear