title: Sinatra with a persistent variable
body: <p>My sinatra app has to parse a ~60MB XML-file. This file hardly ever changes: on a nightly cron job, It is overwritten with another one. </p>
  
  <p>Are there tricks or ways to keep the parsed file in memory, as a variable, so that I can read from it on incoming requests, but not have to parse it over and over for each incoming request?</p>
  
  <p>Some Pseudocode to illustrate my problem.</p>
  
  <pre><code>get '/projects/:id'
    return @nokigiri_object.search("//projects/project[@id=#{params[:id]}]/name/text()")
  end
  
  post '/projects/update'
    if params[:token] == "s3cr3t"
      @nokogiri_object = reparse_the_xml_file
    end
  end
  </code></pre>
  
  <p>What I need to know, is how to create such a @nokogiri_object so that it persists when Sinatra runs. Is that possible at all? Or do I need some storage for that?</p>