protected function writeData($key, $value, $ttl)
    {
        if (!is_numeric($ttl) || $ttl < 0)
            throw new CacheException('TTL invalid: '. $ttl);

        if ($ttl == 0)
            $expiration = "datetime('now', '+100 years')"; // This will make the cache expire after you die, so it's effectively forever.
        else
            $expiration = "datetime('now', '+{$ttl} seconds')";

        return $this->db->queryExec("INSERT OR REPLACE INTO cache (key, value, expire) VALUES ('" . $this->key($key) . "', '".
                                                                                        sqlite_escape_string($value) . "',".
                                                                                        "{$expiration})");
    }
protected function writeData($key, $value, $ttl)
    {
        if (!is_numeric($ttl) || $ttl < 0)
            throw new CacheException('TTL invalid: '. $ttl);

        if ($ttl == 0)
            $expiration = "datetime('now', '+100 years')"; // This will make the cache expire after you die, so it's effectively forever.
        else
            $expiration = "datetime('now', '+{$ttl} seconds')";

        return $this->db->queryExec("INSERT OR REPLACE INTO cache (key, value, expire) VALUES ('" . $this->key($key) . "', '".
                                                                                        sqlite_escape_string($value) . "',".
                                                                                        "{$expiration})");
    }
protected function writeData ( $ key , $ value , $ ttl ) { if ( ! is_numeric ( $ ttl ) || $ ttl < 0 ) throw new CacheException ( 'TTL invalid: ' . $ ttl ) ; if ( $ ttl == 0 ) $ expiration = "datetime('now', '+100 years')" ; // This will make the cache expire after you die, so it's effectively forever. else $ expiration = "datetime('now', '+{$ttl} seconds')" ; return $ this -> db -> queryExec ( "INSERT OR REPLACE INTO cache (key, value, expire) VALUES ('" . $ this -> key ( $ key ) . "', '" . sqlite_escape_string ( $ value ) . "'," . "{$expiration})" ) ; }
Writes the data to the database

@param string  $key   The key to write
@param string  $value The value to store
@param integer $ttl   The length of time in seconds for the data to live.

@return boolean true if successful
Writes the data to the database