final protected function cache_query($sql, $result){
        if( isset($this->query_cache[$sql]) ){
            $this->query_cache[$sql] = $result;
        }elseif( count($this->query_cache) >= $this->cache_limit ){
            // Remove oldest cache
            array_shift($this->query_cache);
            // save query
            $this->query_cache[$sql] = $result;
        }
    }