# File lib/storage/sqlitestore.rb, line 31
  def initialize(dbfile)
    super()
    @dbfile = "#{dbfile}.sqlite"

    # check if database exists and build it if not
    build_database
    log.info "Loading world..."

    # open database and sets @dbtop to highest object id
    @db = SQLite::Database.open(@dbfile)
    @db.cache_size = 1000;     # default is 2000 1.5K pages
    @db.synchronous = 0;       # dangerous if OS crash, but fast
    @db.type_translation = true;
    @db.execute("select id from tmud;") do |i|
      @dbtop = i.first if i.first > @dbtop
    end

    @cache = CacheManager.new(@db)
    log.info "Database '#{@dbfile}' loaded...highest id = #{@dbtop}."
#    log.debug @db.inspect
  rescue
    log.fatal $!
    raise
  end