title: Compojure/Ring: Why doesn't a session with cookie-store survive a server restart?
body: <p>I have a compojure app that uses the ring session wrapper to store the OAuth token associated with the current user. I would like for this token to remain available when the server restarts, so that I don't have to go through the auth process each time.</p>
  
  <p>I assumed that using the cookie-store instead of the default memory-store would help, but it does not. What am I missing?</p>
  
  <p>This is the relevant part of the code:</p>
  
  <pre><code>(defn auth-callback-handler
    [session {code :code}]
    (let [token (retrieve-token code)]
      (-&gt; (redirect "/") (assoc :session (assoc session :token token)))))
  
  (defroutes app-routes
    (GET "/" {session :session} (root-handler session))
    (GET "/auth-callback" {session :session params :params} (auth-callback-handler session params))
    (route/not-found "Not Found"))
  
  (def app
    (-&gt; (handler/site app-routes)
        (wrap-session {:store (cookie-store {:key "a 16-byte secret"})})))
  </code></pre>
  
  <p>The function <code>root-handler</code> uses the token to decide if someone is logged in or not, but does not return anything in the way of session info.</p>