src/lastfmapi/Lib/Cache.php
public function set($unique_vars, $body)
    {
        if ($this->enabled == true) {
            $expire = time() + $this->config['cache_length'];
            $query = "INSERT INTO cache (unique_vars, expires, body) VALUES ('" . htmlentities(serialize($unique_vars), ENT_QUOTES, 'UTF-8') . "', '" . $expire . "', \"" . htmlentities(serialize($body), ENT_QUOTES, 'UTF-8') . "\")";
            if ($this->db->query($query)) {
                return true;
            } else {
                // TODO: Handle error
                return false;
            }
        } else {
            return false;
        }
    }
public function set($unique_vars, $body)
    {
        if ($this->enabled == true) {
            $expire = time() + $this->config['cache_length'];
            $query = "INSERT INTO cache (unique_vars, expires, body) VALUES ('" . htmlentities(serialize($unique_vars), ENT_QUOTES, 'UTF-8') . "', '" . $expire . "', \"" . htmlentities(serialize($body), ENT_QUOTES, 'UTF-8') . "\")";
            if ($this->db->query($query)) {
                return true;
            } else {
                // TODO: Handle error
                return false;
            }
        } else {
            return false;
        }
    }
public function set ( $ unique_vars , $ body ) { if ( $ this -> enabled == true ) { $ expire = time ( ) + $ this -> config [ 'cache_length' ] ; $ query = "INSERT INTO cache (unique_vars, expires, body) VALUES ('" . htmlentities ( serialize ( $ unique_vars ) , ENT_QUOTES , 'UTF-8' ) . "', '" . $ expire . "', \"" . htmlentities ( serialize ( $ body ) , ENT_QUOTES , 'UTF-8' ) . "\")" ; if ( $ this -> db -> query ( $ query ) ) { return true ; } else { // TODO: Handle error
 return false ; } } else { return false ; } }
Adds new cache data to the database
@access public
@param array $unique_vars Array of variables that are unique to this piece of cached data
@param string $body The contents of the cache to put into the database
@return boolean
Adds new cache data to the database