public function put($sql, $cls = null)
    {
        $this->expireCache();
        $hash = self::_sqlHash($sql);

        if (array_key_exists($hash, $this->_prepared_cache)) {
            Log::log("SQL: already prepared:\n$sql");
            return $this->_prepared_cache[$hash]["statement"];
        } else {
            Log::log("SQL: inserting on cache: $sql");
        }
        $cls      = $cls ? $cls : "TORM\Model";
        $con      = $cls::resolveConnection();
        $prepared = $con->prepare($sql);
        $this->_prepared_cache[$hash] = ["statement" => $prepared, "timestamp" => time()];
        return $prepared;
    }
public function put($sql, $cls = null)
    {
        $this->expireCache();
        $hash = self::_sqlHash($sql);

        if (array_key_exists($hash, $this->_prepared_cache)) {
            Log::log("SQL: already prepared:\n$sql");
            return $this->_prepared_cache[$hash]["statement"];
        } else {
            Log::log("SQL: inserting on cache: $sql");
        }
        $cls      = $cls ? $cls : "TORM\Model";
        $con      = $cls::resolveConnection();
        $prepared = $con->prepare($sql);
        $this->_prepared_cache[$hash] = ["statement" => $prepared, "timestamp" => time()];
        return $prepared;
    }
public function put ( $ sql , $ cls = null ) { $ this -> expireCache ( ) ; $ hash = self :: _sqlHash ( $ sql ) ; if ( array_key_exists ( $ hash , $ this -> _prepared_cache ) ) { Log :: log ( "SQL: already prepared:\n$sql" ) ; return $ this -> _prepared_cache [ $ hash ] [ "statement" ] ; } else { Log :: log ( "SQL: inserting on cache: $sql" ) ; } $ cls = $ cls ? $ cls : "TORM\Model" ; $ con = $ cls :: resolveConnection ( ) ; $ prepared = $ con -> prepare ( $ sql ) ; $ this -> _prepared_cache [ $ hash ] = [ "statement" => $ prepared , "timestamp" => time ( ) ] ; return $ prepared ; }
Put a prepared statement on cache, if not there.

@param string $sql query
@param string $cls class to resolve connection

@return object prepared statement
Put a prepared statement on cache if not there .