title: How can I refresh the session during a POST request?
body: <p>I'm building an Ajax app in Symfony2 where a user logs in, and then from that point forward everything is handled by POST requests. After defining the session lifetime to 5 minutes in <code>config.yml</code>, I run into the problem of the user's session being invalidated after 5 minutes even though they're making POST requests. Each time a request is made, I'd like to reset the countdown before the session invalidates, but I'm not sure how to do this efficiently. </p>
  
  <p>The method I'm currently thinking about is writing a listener for the <code>kernel.request</code> event, checking if the request method is  POST, and manipulating the session class. I haven't done this yet, but it doesn't seem like a clean solution, since the listener needs to fire everytime a request is made.</p>
  
  <p>Here's my session config:</p>
  
  <pre><code>session:  
      default_locale: %locale%  
      auto_start:     true  
      lifetime:       300  
  </code></pre>
  
  <p>Any ideas? Is the solution plain PHP and not Symfony?</p>